如何將倉庫同時推送到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