如何将带有 LFS 文件的 git 存储库转移到另一个存储库?
How to transfer a git repository with LFS file to another repository?
我们有一个本地 git 服务器,带有 LFS 文件。我们计划将所有内容转移到 MS Azure DevOps 上。
经过一些研究,我读到建议做一个“镜像”克隆,拥有一切(至少标签):
git clone --mirror
然后,因为我有一些 LFS 文件,我也想得到它们:
git lfs fetch --all
但是我得到这个错误:
Error: Failed to call git rev-parse --git-dir --show-toplevel: "fatal: this operation must be run in a work tree\n"
Not in a git repository.
对于我正在阅读的内容,git lfs fetch 在 bare
存储库上不起作用(我不知道这是什么,但我认为它与 --mirror
选项。
所以我的问题是:我应该怎么做才能将所有内容转移到这个新存储库? (此后本地服务器将关闭)。
谢谢
What should I do to transfer everything to this new repository? (the local server will be shutdown after this).
那是因为 git-lfs
与 git 用于 bare
存储库的默认目录名称不兼容。
要解决此问题,您可以尝试使用以下 git 命令:
git clone --bare https://xxx/xxx/old-repository.git
cd old-repository.git
git lfs fetch --all
git push --mirror https://xxx/xxx/new-repository.git
git lfs push --all https://xxx/xxx/new-repository.git
您可以查看此文档 Mirroring a repository that contains Git Large File Storage objects 了解一些详细信息。
我们有一个本地 git 服务器,带有 LFS 文件。我们计划将所有内容转移到 MS Azure DevOps 上。 经过一些研究,我读到建议做一个“镜像”克隆,拥有一切(至少标签):
git clone --mirror
然后,因为我有一些 LFS 文件,我也想得到它们:
git lfs fetch --all
但是我得到这个错误:
Error: Failed to call git rev-parse --git-dir --show-toplevel: "fatal: this operation must be run in a work tree\n"
Not in a git repository.
对于我正在阅读的内容,git lfs fetch 在 bare
存储库上不起作用(我不知道这是什么,但我认为它与 --mirror
选项。
所以我的问题是:我应该怎么做才能将所有内容转移到这个新存储库? (此后本地服务器将关闭)。
谢谢
What should I do to transfer everything to this new repository? (the local server will be shutdown after this).
那是因为 git-lfs
与 git 用于 bare
存储库的默认目录名称不兼容。
要解决此问题,您可以尝试使用以下 git 命令:
git clone --bare https://xxx/xxx/old-repository.git
cd old-repository.git
git lfs fetch --all
git push --mirror https://xxx/xxx/new-repository.git
git lfs push --all https://xxx/xxx/new-repository.git
您可以查看此文档 Mirroring a repository that contains Git Large File Storage objects 了解一些详细信息。