如何阻止Google索引我的Github存储库 [英] How to stop Google indexing my Github repository

查看:135
本文介绍了如何阻止Google索引我的Github存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Github来存储我的一个网站的文本,但问题是Google也在Github中编制索引文本。所以相同的文本将显示在我的网站和Github上。例如这个搜索最受欢迎的是我的网站。第二个命中是Github存储库。



我不介意人们是否看到来源,但我不希望Google将其编入索引(并且可能会对重复内容加以惩罚。)除了将存储库私有化之外,还有什么办法可以告诉Google停止对它进行索引吗?



网页?这些源代码位于Github存储库中。他们是否有同样的重复问题?



这次搜索最热门的搜索会导致 Marpa网站,但我没有看到<搜索结果中列出了一个href =https://github.com/jeffreykegler/Marpa-web-site/blob/gh-pages/index.html>来源。

https://github.com/robots.txt 文件允许在'master'分支中对blob建立索引,但限制所有其他分支。所以如果你没有'master'分支,Google不应该为你的页面编制索引。



如何删除'master'分支:



在您的克隆中创建一个新分支 - 让我们将其称为main并将其推送到GitHub中

  git checkout -b main 
git push -u origin main

在GitHub上更改默认分支(请参阅存储库的设置部分)
或这里 https://github.com/blog/421-pick-your-default-branch

然后从你的克隆和GitHub中删除master分支:

  git branch -d master 
git push origin:master



让其他可能已经分叉你的仓库的人也这样做了。



如果你想在经济上支持GitHub,你可以去私人 https://help.github.com/articles/making-a-public-repository-private


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?

解决方案

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

这篇关于如何阻止Google索引我的Github存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆