How can I stop Google from caching a site while I'm working on it?

To prevent access to site content whilst you are building a site, add a site-wide password and then customise the lock screen.

When you add a site-wide password before you add content it tells search engines not to index your site.

If you’re hiding your site after it’s been active, setting a password will prevent search engines from indexing it further. Any content that search engines have indexed before you added the password will still appear in search results, but links to the pages will send visitors to the lock screen.