The question was asked, “How do we know what God said when He was creating the earth and all that’s in it? He was the only one there, so how do we know what He said?”
This is a question related to the inspiration of the Bible. Paul wrote to Timothy that “All Scripture is given by inspiration of God, and is profitable for doctrine, for reproof, for correction, for instruction in righteousness, that the man of God may be complete, thoroughly equipped for every good work.” (2 Timothy 3:16-17)
Because we believe in the inspiration of the Bible… that all Scripture is actually “God-breathed” (that’s what that phrase “given by inspiration of God” literally means), then we accept the account of creation in Genesis 1-2 completely. We know that the words that are attributed to God in that passage were actually spoken by God. But of course, we also know that Moses was the human author God used to pen those chapters, and so the question naturally arises, “How did Moses know what to write?”
Peter’s words help. In 1 Peter 1:20-21 he wrote, “knowing this first, that no prophecy of Scripture is of any private interpretation, for prophecy never came by the will of man, but holy men of God spoke as they were moved by the Holy Spirit. In essence he said that no human being made up what was written in Scripture, but the Holy Spirit used men, and moved them to write exactly what He wanted written. The result of that process is that the words we have in our Bible are the very words God wanted written, even though they were written down by various men.
Now, the Holy Spirit inspired those various men in different ways.
Sometimes He actually dictated what needed written down:
Then the LORD said to Moses, “Write these words, for according to the tenor of these words I have made a covenant with you and with Israel.” (Exodus 34:27)
“Thus speaks the LORD God of Israel, saying: ‘Write in a book for yourself all the words that I have spoken to you. (Jeremiah 30:2)
Then the LORD answered me and said: “Write the vision And make it plain on tablets, That he may run who reads it. (Habakkuk 2:2)
saying, “I am the Alpha and the Omega, the First and the Last,” and, “What you see, write in a book and send it to the seven churches which are in Asia: to Ephesus, to Smyrna, to Pergamos, to Thyatira, to Sardis, to Philadelphia, and to Laodicea.” … “Write the things which you have seen, and the things which are, and the things which will take place after this. (Revelation 1:11, 19)
Other times, He didn’t dictate, but rather just guided men to write, superintending their writing and experiences such that the end result was exactly what it should be:
it seemed good to me also, having had perfect understanding of all things from the very first, to write to you an orderly account, most excellent Theophilus, (Luke 1:3)
If anyone thinks himself to be a prophet or spiritual, let him acknowledge that the things which I write to you are the commandments of the Lord. (1 Corinthians 14:37)
Sometimes He dictated what NOT to write:
Now when the seven thunders uttered their voices, I was about to write; but I heard a voice from heaven saying to me, “Seal up the things which the seven thunders uttered, and do not write them.” (Revelation 10:4)
So, whether God actually dictated the words to Moses, or breathed those words into his mind and pen in some other way, He inspired Moses to write exactly what was said during creation week.