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路径即可1234[remote "origin"] url = https://git.oschina.net/openks/test_git_mirroe.git fetch = +refs/heads/*:refs/remotes/origin/* url = new git url