Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Google indexing my Github repository

I use Github to store the text of one of my web sites, but the problem is Google indexing the text in Github as well. So the same text will show up both on my site and on Github. e.g. this search The top hit is my site. The second hit is the Github repository.

I don't mind if people see the sources but I don't want Google to index it (and maybe penalize for duplicate content.) Is there any way, besides taking the repository private, to tell Google to stop indexing it?

What happens in the case of Github Pages? Those are sites where the source is in a Github repository. Do they have the same problem of duplication?

Take this search the top most hit leads to the Marpa site but I don't see the source listed in the search result. How?

like image 543
szabgab Avatar asked Apr 05 '13 22:04

szabgab


People also ask

How do I make a GitHub repository not searchable?

Public : You can put your code as opensource , So it helps to other people. 2. Private : For this private repository, you should pay the money to github which is not searchable to github users. One solution is, you can install gitlab on your server which is also keep your repository as private.

Can I hide my GitHub repository?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility. Select a visibility.

How do I stop watching a repository?

To unwatch (or unsubscribe from) repositories quickly, navigate to github.com/watching to see all the repositories you're following. For more information, see "Unwatching repositories." To unsubscribe from multiple notifications at the same time, you can unsubscribe using your inbox or on the subscriptions page.


2 Answers

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

like image 100
szabgab Avatar answered Sep 18 '22 02:09

szabgab


simple answer: make your repo private.

https://help.github.com/articles/making-a-public-repository-private

like image 20
xero Avatar answered Sep 17 '22 02:09

xero