A:以别人的版本建立一个自己的库
1.获得他人库的clone
git clone --bare
2.建立自己的库
git init --bare
3.同步内容
1)cd 到clone的库目录
2)同步
git push --mirror (自己库url)
B:以现有库同步别人的版本
1.获得他人库的clone
git clone --bare
2.同步内容
1)cd 到clone的库目录
2)同步
git push --all (自己库url)
更新A:
本地.git / config中
[remote "origin"] 添加
fetch = +refs/*:refs/*
mirror = true
运行
git fetch --all
1.获得他人库的clone
git clone --bare
2.建立自己的库
git init --bare
3.同步内容
1)cd 到clone的库目录
2)同步
git push --mirror (自己库url)
B:以现有库同步别人的版本
1.获得他人库的clone
git clone --bare
2.同步内容
1)cd 到clone的库目录
2)同步
git push --all (自己库url)
更新A:
本地.git / config中
[remote "origin"] 添加
fetch = +refs/*:refs/*
mirror = true
运行
git fetch --all
git 仓库直接同步另一个仓库,直接fetch url 填另一个仓库的地址,fetch -all 即可同步
如果需要中转,先git clone --bare 下来仓库,再push -all url 到另一个仓库即可