如何镜像和同步GitHub和SourceForge存储库

如何镜像和同步GitHub和SourceForge存储库

本文介绍了如何镜像和同步GitHub和SourceForge存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub上有一个仓库,在SourceForge上有一个空仓库。我如何制作镜像并同步它们?

在StackOverflow中有,它解释了如何推送到多个存储库,但如何在GitHub或SourceForge中进行提交时如何同步它们?

解决方案
保留两个单独的远程代码用于Google代码,另一个用于github。

  git remote add origin<<您的google代码repo url>> 
git remote add github<< your github repo url>>

现在您有两种方法同步回购。

  git远程更新

这将从所有远程网址,但不会合并。您必须手动合并代码。或者,如果您需要在所有镜像中提交所有提交,则可以通过指定要合并的代码(可能为主)的分支名称来分别从中提取这些提交。

  git pull origin master 
git pull github master

推送到多个分支可以按照您的问题中的链接或使用单个命令完成



pre $ g $ git push origin master
git push github master


I have a repository on GitHub and an empty repository at SourceForge. How do I make mirrors and synchronize them?

On StackOverflow there is "Mirroring a repository across Github, Sourceforge and Google Code" which explains how to push to multiple repositories, but how do I synchronize them when commits will be in GitHub or SourceForge?

解决方案

Keep two separate remote one for google code and another for github.

git remote add origin <<your google code repo url>>
git remote add github <<your github repo url>>

Now you have two ways to sync the repos.

git remote update

This will fetch from all remote urls but won't merge. You have to merge the code manually. Alternatively if you need all the commits in both of your mirrors you can pull from them separately by specifying a branch name to which the the code to be merged (possibly master).

git pull origin master
git pull github master

pushing to multiple branches can be done as mentioned in the link in your question or using individual commands

git push origin master
git push github master

这篇关于如何镜像和同步GitHub和SourceForge存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 11:46