Github 如何和 Gitee 进行同步?
首先关联Github和Gitee的远程仓库;
git remote add github git@github.com:code/demo.git git remote add gitee git@gitee.com:code/demo.git
然后打开“.git”文件夹内的配置文件;接着修改remote改两个,一个Github库另一个Gitee库;
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@github.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/github/* [branch "master"] remote = origin merge = refs/heads/master
将上述文件内容[remote "origin"]内容复制,修改origin名称,内容如下:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "github"] url = git@github.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/github/* [remote "gitee"] url = git@gitee.com:chloneda/demo.git fetch = +refs/heads/*:refs/remotes/gitee/* [branch "master"] remote = origin merge = refs/heads/master
最后代码分别提交到Github和Gitee即可。
提交到github
git push github master
提交到码云
git push gitee master
推荐教程:《Git教程》
以上是Github 如何和 Gitee 进行同步?的详细内容。更多信息请关注PHP中文网其他相关文章!