工作中我们有时候需要做git仓库迁移,下面简单介绍下仓库迁移的步骤
- 把要迁移的项目原地址克隆一份裸版本库。
cd /Users/admin/Desktop
git clone --bare (项目地址)

注:--bare 创建的克隆版本库都不包含工作区,直接就是版本库的内容,这样的版本库称为裸版本库。
-
在git 服务器上创建新的项目,我这边取名为ChangeRepo
-
以镜像推送的方式把裸版本库代码上传到刚刚创建的ChangeRepo的地址
cd project.git
git push --mirror (ChangeRepo的地址)

- 删除本地代码
cd ..
rm -rf project.git

网友评论