如何将仓库同时推送到github和gitee呢?
编辑.git
目录下的config文件,给[remote "origin"]
下面添加两行
url = git@gitee.com:Telogen/Journal-Phenomics.git
fetch = +refs/heads/*:refs/remotes/origin/*
即:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:Telogen/Phenomics.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@gitee.com:Telogen/Journal-Phenomics.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
这样使用git push
的时候只需push一次即可
如果为了避免冲突,可进行两个remote的命名,即:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "github"]
url = git@github.com:Telogen/Phenomics.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "gitee"]
url = git@gitee.com:Telogen/Journal-Phenomics.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
这样,push时就需要分别进行两次
git push github matser
git push gitee master
参考
https://blog.csdn.net/weixin_44893902/article/details/125147574
网友评论