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

为了防止Github被墙,最好在国内的托管商做一个备份,这就需要同时提交到多个远端仓库,例如一个open source项目同时要提交csdn和github,url分别是: git@github.com:lutaf/auto-complete.git git@code.csdn.net:lutaf/autocomplete.git 方法很简单,一共分4步: #### 第一步 添加remote信息 git remote add gh git@github.com:lutaf/auto-complete.git git remote add cn git@code.csdn.net:lutaf/autocomplete.git #### 第二步 为每个仓库建立单独的分支 git checkout -b github ... git checkout -b csdn #### 第三步 在各自分支上完成开发,并提交 #### 第四步 把本地分支推送到远端仓库的master分支 git checkout csdn git push cn csdn:master #### 第四步 很关键,一定是要推送到远端仓库的master分支
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2022

备案号:京ICP备15003423号-3