问题描述
如何为外部 git 存储库创建 github 镜像,使其显示为真实镜像",例如,如 https://github.com/mirrors?
How do I create a github mirror for an external git repository, such that it appears as "real mirror", e.g., as in https://github.com/mirrors?
到目前为止,我使用:
cd /path/to/bare/repository
git remote add --mirror github [email protected]:user/repo.git
并配置post接收钩子来做一个git push --quiet github
.但是这样github不识别镜像.
and configure the post receive hook to do a git push --quiet github
. This way, however, github does not recognize the mirror.
任何想法如何以 github 方式进行操作,例如镜像来自"出现在存储库名称下方?
Any ideas how to do it the github way, such that "Mirrorred from" appears underneath the repostiory name?
推荐答案
根据与 GitHub 支持团队的沟通,我发现 GitHub 目前没有为用户提供以这种方式镜像存储库的直接机制.
Based on communicating with GitHub's support team, I found that GitHub currently offers no direct mechanism for a user to mirror repositories in this fashion.
但是,您可以要求 GitHub 为属于组织的存储库安装此服务.然后,GitHub 将现有存储库配置为这样的镜像,并在一个时间间隔内从中提取,该时间间隔是它们拥有的总镜像数量的函数.
However, one can ask GitHub to install this service for repositories which are part of an organization. GitHub then configures an existing repository as such a mirror and pulls from it in an interval that is a function of the number of overall mirrors they have.
编辑:正如 Stuart 指出的那样,GitHub 不再接受镜像任意存储库的请求.剩下的唯一选项是我在问题中发布的解决方案,即创建一个 post-receive hook 以自动推送到您的 GitHub 存储库.
EDIT: as Stuart points out, GitHub no longer accepts requests for mirroring arbitrary repositories. The only remaining option is the solution I posted in my question, i.e., creating a post-receive hook to automatically push to your GitHub repository.
这篇关于创建官方 github 镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!