How to stop Google indexing my Github repository

The https://github.com/robots.txt file of GitHub allows the indexing of the blobs in the ‘master’ branch, but restricts all other branches. So if you don’t have a ‘master’ branch, Google is not supposed to index your pages.

How to remove the ‘master’ branch:

In your clone create a new branch – let’s call it ‘main’ and push it to GitHub

git checkout -b main
git push -u origin main

On GitHub change the default branch (see in the Settings section of your repository)
or here https://github.com/blog/421-pick-your-default-branch

Then remove the master branch from your clone and from GitHub:

git branch -d master
git push origin :master

Get other people who might have already forked your repository to do the same.

Alternatively, if you’d like to financially support GitHub, you can go private https://help.github.com/articles/making-a-public-repository-private

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)