使用 git clone --mirror 和 git push --mirror 移动 git repo

2023-11-26

我必须将几个存储库从 Gitlab 移至 Bitbucket,并发现最简单的方法似乎是:

  1. 在 Bitbucket 中创建新的空存储库
  2. git clone --mirror [email protected]:path/to/repo.git
  3. cd repo.git
  4. git remote set-url origin [email protected]:path/to/repo.git
  5. git push --mirror

这似乎复制了整个存储库,包括标签、所有分支等,而且我还没有发现这种方法的任何缺点。然而,由于我没有在互联网上的任何地方看到过这种方法,我担心我错过了一些东西。

我可以安全地使用此方法并随后删除旧的存储库吗?


从仅回购的角度来看,它应该是安全的。所有引用(分支、标签)均按原样复制。

As torek中提到的comments,其他内容可能会被省略:配置、特定于托管的设置、挂钩。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 git clone --mirror 和 git push --mirror 移动 git repo 的相关文章

随机推荐