创建官方github镜像

mav*_*vam 105 github mirroring

如何为外部git存储库创建github镜像,使其显示为"真实镜像",例如,如https://github.com/mirrors

到目前为止,我使用以下方法设置镜像:

cd /path/to/bare/repository
git remote add --mirror github git@github.com:user/repo.git
Run Code Online (Sandbox Code Playgroud)

并配置post receive hook来做一个git push --quiet github.但是,这样,github无法识别镜像.

任何想法如何以github的方式做到这一点,以便"镜像来自"出现在repostiory名称下面?

mav*_*vam 109

基于与github支持团队的沟通,我发现github目前没有为用户提供以这种方式镜像存储库的直接机制.

但是,可以要求github为作为组织一部分的存储库安装此服务.然后,Github将现有存储库配置为这样一个镜像,并在一个间隔中拉出它,该间隔是它们具有的整个镜像数量的函数.

编辑:正如斯图尔特指出的那样,github不再接受镜像任意存储库的请求.唯一剩下的选项是我在我的问题中发布的解决方案,即创建一个post-receive钩子来自动推送到你的github存储库.


Stu*_*ley 9

https://github.com/mirrors的当前内容来看,GitHub似乎不再是"官方镜像",因为大多数想要在GitHub上镜像的项目今天只是组建一个组织,比如Git本身.

还有一项功能请求:https://github.com/isaacs/github/issues/415


Che*_*ana 6

根据导入 Git

出于演示目的,我们将使用:

  • 名为 extuser 的外部帐户
  • 一个名为 ghuser 的 GitHub 个人用户帐户
  • 一个名为 repo.git 的 GitHub 存储库

命令行:

# Makes a bare clone of the external repository in a local directory  
$ git clone --bare https://githost.org/extuser/repo.git

# Pushes the mirror to the new GitHub repository
$ cd *repo.git*
$ git push --mirror https://github.com/ghuser/repo.git

# Remove the temporary local repository.
$ cd ..
$ rm -rf repo.git
Run Code Online (Sandbox Code Playgroud)

  • `git clone --bare` 和 `git clone --mirror` 有什么区别?第二种变体在这里不是更合适吗? (3认同)