“give glory to Yahweh.” In this context, giving glory to Yahweh was acknowledging that Yahweh directed the process in finding Achan, and then confessing his sin and telling what he had done without hiding anything.
“Do not hide it from me!” In many ways this parallels the record of Peter with Ananias and Sapphira in Acts 5:1-11. Both Achan and Ananias and Sapphira were trying to hide the fact that they lied and kept things for themselves, in both cases the facts were not hidden from God (cp. Heb. 4:13), and in both cases it was early in the formation of the community. Here in Joshua 7, Israel had just crossed the Jordan and was forming a nation, and in Acts 5 the early Church was still forming as a believer community.