使用 git clone --mirror 和 git push --mirror 移动 git repo [英] Move git repo with git clone --mirror and git push --mirror

查看:66
本文介绍了使用 git clone --mirror 和 git push --mirror 移动 git repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have to move a couple of repos from Gitlab to Bitbucket and discovered that the easiest way to do it seems to be:

  1. 在 Bitbucket 中创建新的空存储库
  2. git clone --mirror git@gitlab.com:path/to/repo.git
  3. cd repo.git
  4. git remote set-url origin git@bitbucket.org:path/to/repo.git
  5. git push --mirror

这似乎复制了整个 repo,包括标签、所有分支等,我还没有发现这种方法的任何缺点.但是,由于我在互联网上的任何地方都没有看到这种方法,所以我担心我错过了一些东西.

This seems to copy the entire repo including tags, all branches etc. and I haven't discovered any disadvantages of this method yet. However, as I haven't seen this method anywhere on the internet, I'm afraid I'm missing something.

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

Can I safely use this method and remove the old repositories afterwards?

推荐答案

从仅 repo 的角度来看,它应该是安全的.所有 refs(分支、标签)都按原样复制.

From a repo-only standpoint, it should be safe. All refs (branches, tags) are copied as-is.

正如 torek-git-repo-with-git-clone-mirror-and-git-push-mirror#comment85784215_49387671">评论,其他的东西可能会被忽略:配置、主机特定的设置、挂钩.

As torek mentioned in the comments, other things might be left out: configuration, hosting-specific settings, hooks.

这篇关于使用 git clone --mirror 和 git push --mirror 移动 git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆