Git仓库迁移记录

背景:gitlab私服上面,使用 import project的方式,从旧项目迁移到新地址仓库,但是代码一直没拉过去。所以使用命令的方式,进行代码迁移。

Git仓库迁移记录_第1张图片

第一步:使用git clone --mirror git地址,进行代码克隆

git clone --mirror http://xxxxxxxxxxxxx.git 

第二步,进入克隆下来的git目录下,设置代码的新仓库远程地址

git remote set-url --push origin http://xxxxxxxxx.git  

第三步,推送代码到远程仓库

git push --mirror http://xxxxxxxx.git

至此,代码迁移完成。 

你可能感兴趣的:(git,git仓库迁移)