迁移git托管仓库

有个需求,需要将项目从A仓库迁移到B仓库。两个仓库都是gitlab。方法挺简单的,记录一下:

1 从A仓库下载项目裸代码

git clone --bare http://gitlab.a.com/xxx/xxx.git

2 在B创建project

方法略~~~~

3 将代码上传到B仓库

cd xxx.git
git push --mirror http://gitlab.b.com/xxx/xxx.git

4 验证

删除本地的原有代码,然后从B仓库拉一份代码

cd ..
rm -rf xxx.git
git clone http://gitlab.b.com/xxx/xxx.git

就这样了

猜你喜欢

转载自blog.51cto.com/quietguoguo/2411403