git 仓库迁移

2024-12-16  本文已影响0人  Zer0_2584

由于仓库的硬盘满了,又不好扩,所以想把仓库迁移到另一台机器上。

  1. 首先,需要把旧仓库克隆下来
git clone --bare https://github.com/username/old-repo.git

此时会创建出一个 old-repo.git 的文件夹,里面包含了仓库的全部文件。

  1. 然后,创建新仓库

  2. 然后,把克隆下来的仓库推送到新机器上

cd old-repo.git
git push --mirror https://github.com/username/new-repo.git

这样,仓库就迁移完成了,并且也可以查看到历史提交记录。

上一篇 下一篇

猜你喜欢

热点阅读