Then Moses summoned Joshua and said to him in the presence of all Israel, "Be strong and courageous, for you must go with this people into the land that the LORD swore to their forefathers to give them, and you must divide it among them as their inheritance. The LORD himself goes before you and will be with you; he will never leave you nor forsake you. Do not be afraid; do not be discouraged."
Deut 31:7-8
"Moses encourages Joshua. Observe:
1. Though Joshua was an experienced general, and a man of approved gallantry and resolution, who had already signalized himself in many brave actions, yet Moses saw cause to bid him be of good courage, now that he was entering upon a new scene of action; and Joshua was far from taking it as an affront, or as a tacit questioning of his courage, to be thus charged, as sometimes we find proud and peevish spirits invidiously taking exhortations and admonitions for reproaches and reflections. Joshua himself is very well pleased to be admonished by Moses to be strong and of good courage.
2. He gives him this charge in the sight of all Israel, that they might be the more observant of him whom they saw thus solemnly inaugurated, and that he might set himself the more to be an example of courage to the people who were witnesses to this charge here given to him as well as to themselves.
3. He gives him the same assurances of the divine presence, and consequently of a glorious success, that he had given the people. God would be with him, would not forsake him, and therefore he should certainly accomplish the glorious enterprise to which he was called and commissioned: Thou shalt cause them to inherit the land of promise. Note, Those shall speed well that have God with them; and therefore they ought to be of good courage. Through God let us do valiantly, for through him we shall do victoriously; if we resist the devil, he shall flee, and God shall shortly tread him under our feet."