git 同时向两个仓库提交同一个分支
2014-11-21 08:37
381 查看
说明:此前参考了某个资料,但是实在记不得来源了!
目的:
1 . 为了同时在两个git仓库中备份代码,以避免某个仓库崩溃的情况!
2. 以git push origin master 同时备份两个仓库(以oschina 与 csdn为例)
步骤:
1. 分别在两个仓库建立相应的项目
2. git remote add origin AAA
3. git remote add origin BBB 此时会提示,origin 已经存在,我们通过编辑 项目中的文件夹 ~/.git/config
将
[remote "origin"]
url = AAA
fetch = +refs/heads/*:refs/remotes/origin/
修改为
[remote "origin"]
url = AAA
url = BBB
fetch = +refs/heads/*:refs/remotes/origin/
4. git push origin master 成功
5. 此时需要输入密码,可通过相应设置来实现无密码访问,
成功后配置文件 .git-credentials中内容为:
https://user:passwd@code.csdn.net https://user:passwd@git.oschina.net
目的:
1 . 为了同时在两个git仓库中备份代码,以避免某个仓库崩溃的情况!
2. 以git push origin master 同时备份两个仓库(以oschina 与 csdn为例)
步骤:
1. 分别在两个仓库建立相应的项目
2. git remote add origin AAA
3. git remote add origin BBB 此时会提示,origin 已经存在,我们通过编辑 项目中的文件夹 ~/.git/config
将
[remote "origin"]
url = AAA
fetch = +refs/heads/*:refs/remotes/origin/
修改为
[remote "origin"]
url = AAA
url = BBB
fetch = +refs/heads/*:refs/remotes/origin/
4. git push origin master 成功
5. 此时需要输入密码,可通过相应设置来实现无密码访问,
成功后配置文件 .git-credentials中内容为:
https://user:passwd@code.csdn.net https://user:passwd@git.oschina.net
相关文章推荐
- 将提交同时推送到两个Git仓库
- 对一个项目同时使用svn和git两个远程仓库
- git同时提交到两个仓库
- Git之新建一个分支并且提交代码带远程仓库
- 如何将一个表单同时提交到两个地方处理
- 如何将一个表单同时提交到两个地方处理
- Git同时提交到多个远程仓库
- 使用git初始化本地仓库并提交到远程分支
- git 克隆远程仓库并创建分支、提交分支、获取分支
- phabricator:关于如何使用 arc 提交一个分支的 diff (规则git:HEAD^)
- git 两个中心仓库上的分支 merge
- git 将一个本地文件目录提交到远程仓库的步骤
- 如何将一个表单同时提交到两个地方处理
- Git如何同时删除多个仓下的同一个分支
- Git-在一个电脑上同时使用两个Git的账号
- 一个表单同时提交到两个不同的页面
- git 两个中心仓库上的分支 merge
- 【git】在git远程仓库中创建一个新项目并把本地代码提交上去
- Git 问题,一个 master,多个新功能分支,怎样有序地合并和提交
- 将Git工程提交到两个不同的仓库