git仓库备份
git仓库备份
需求很简单
在oschina上做主要的代码,在coding做代码备份  
- 首先在oschina和coding上分别创建项目test_git_mirroe
- 从oschina上clone代码git clone https://git.oschina.net/openks/test_git_mirroe.git
- 跳转到项目目录cd test_git_mirroe
- 添加coding的远程仓库git remote add coding https://git.coding.net/zhuyangxing/test_git_mirroe.git
- 提交coding做镜像代码git push --mirror coding
- 以后在test_git_mirroe上提交的代码都提交到oschina上
- 想要在coding上同步就执行git push --mirror coding即可
git一次提交到两个仓库
修改.git文件夹下的config文件
在fetch下添加想要提交的其他git路径即可1
2
3
4[remote "origin"]
  url = https://git.oschina.net/openks/test_git_mirroe.git
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = new git url