码迷,mamicode.com
首页 > 其他好文 > 详细

git项目同时支持多个远端仓库

时间:2015-08-17 06:29:13      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

为了防止github被墙,最好在国内的托管商做一个备份,这就需要同时提交到多个远端仓库,例如一个open source项目同时要提交csdn和github,url分别是

  1. git@github.com:lutaf/auto-complete.git
  2. git@code.csdn.net:lutaf/autocomplete.git

方法很简单,一共分4步

第一步:添加remote信息

  1. git remote gh git@github.com:lutaf/auto-complete.git
  2. git remote cn git@code.csdn.net:lutaf/autocomplete.git

第二步:为每个仓库建立单独的分支

  1. git checkout -b github
  2. ...
  3. git checkout -b csdn

第三步:在各自分支上完成开发,并提交

第四步:把本地分支推送到远端仓库的master分支

  1. git checkout csdn
  2. git push  cn csdn:master

第四步很关键,一定是要推送到远端仓库的master分支

git项目同时支持多个远端仓库

标签:

原文地址:http://www.cnblogs.com/x113/p/4735425.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!