使用git将code同时提交到github,gitee,coding

现在的代码托管平台层出不穷,从最初的国外的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.png

修改config文件.png

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

 

 

config内容.png


修改完成后可使用 

git remote -v

 

git-remote-v查看远程仓库信息.png

命令查看远程仓库信息
三步曲将code push

成功提交.png

 

切换到仓库查各个仓库的code:

github.png

 

gitee.png

 

coding.png

 

 

请输入图片描述


Code submission success

 

 

文章链接:  https://www.w4ctech.cn/github/push.html   (转载时请注明本文出处及文章链接)

posted @ 2018-03-04 20:57  21cm  阅读(433)  评论(1)    收藏  举报