现在的代码托管平台层出不穷,从最初的国外的github,发展到由开源中国创办的gitee,再到现在的coding。
如果我们想要将同一份code提交到这些不同代码托管平台的仓库,可以使用修改config文件夹的方法,具体操作方法如下:
添加到github仓库的配置命令:
git git remote add origin https://github.com/w4ctech/hellogit.git
复制代码
添加到gitee仓库的配置命令:
git remote set-url --add origin https://gitee.com/w4ctech/hellogit.git
复制代码
添加到coding仓库的配置命令:
git remote set-url --add origin https://git.coding.net/w4ctech/hellogit.git
复制代码
或者直接修改当前.git文件夹下
的
config文件内容为
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://git.coding.net/w4ctech/hellogit.git
fetch = +refs/heads/*:refs/remotes/origig/*
[remote "origin"]
url = https://git.coding.net/w4ctech/hellogit.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/w4ctech/hellogit.git
url = https://gitee.com/w4ctech/hellogit.git
复制代码
修改完成后可使用 git remote -v
命令查看远程仓库信息
三步曲将code push
切换到仓库查各个仓库的code:
Code submission success