将Git 项目迁移到另一个仓库

将Git 项目迁移到另一个仓库

1、创建旧仓库的裸克隆

git clone --bare https://github.com/exampleuser/old-repository.git

执行上述命令后,会在本地生成一个名叫 old-repository.git的文件夹。

2、迁移到新仓库

cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git

这样的话,项目就已经迁移到新仓库了。

注意,我们不需要手动新建一个空的新仓库,当我们执行上述命令之后,新仓库就已经自动创建好了。

posted @ 2021-11-23 09:18  码农阿亮  阅读(3458)  评论(0编辑  收藏  举报