The command we hear again and again is the same as that given by Joshua to the tribes of Reuben, Gad and Manasseh before they went back to their families on the other side of the Jordan River:

22:5 But be very careful to obey all the commands and the instructions that Moses gave to you. Love the Lord your God, walk in all his ways, obey his commands, hold firmly to him, and serve him with all your heart and all your soul.

It was the theme of his last words to Israel:

23:6-8 So be very careful to follow everything Moses wrote in the Book of Instruction. Do not deviate from it, turning either to the right or to the left. Make sure you do not associate with the other people still remaining in the land. Do not even mention the names of their gods, much less swear by them or serve them or worship them. Rather, cling tightly to the Lord your God as you have done until now.

And it came with a warning:

24:20 If you abandon the Lord and serve other gods, he will turn against you and destroy you, even though he has been so good to you.