本文给大家带来关于GIT的知识教程,一起聊聊如何实现Github与Gitee 同步,希望能够帮助到大家,下面一起来看一下。
如何实现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
关于Github与Gitee 同步的实现过程分享就到这里,翼速应用平台内有更多相关资讯,欢迎查阅!
我来说两句