Git lfs 从本地裸仓库获取?或者 LFS 文件的其他本地副本?

Git lfs fetch from a local bare repo? Or other local copy of LFS files?

我的小组正在与另一个小组合作进行一个项目,我们为合作建立了一个 GitHub 组织。现在协作结束,我们即将从 GitHub 中删除该组织,我需要为我的团队工作的存储库创建一个本地副本。

我的理解是 git clone --bare <url> 是一个很好的方法,但是其中一些 repos 使用 LFS。我希望我可以按照说明 here 进行操作,但不是推送到新的远程,而是在本地克隆裸存储库。换句话说,我想这样做:

git clone --bare git@github.com:<organization>/somerepo.git
cd somerepo.git/
git lfs fetch --all
cd ..
git clone somerepo.git/
cd somerepo
# View source code, build, checkout other branches, etc.

我希望 LFS 能直接从裸仓库中获取。不幸的是,正如我所担心的那样,它似乎并没有那样工作。

有没有办法做到这一点,或者以其他方式获得存储库的本地工作副本——包含所有分支和标签以及所有大文件的本地副本?如果重要的话,我们不需要能够添加新的提交,只需签出不同的分支并访问所有文件。

你应该 transfer your repository from your organisation to your user account.

If the transferred repository uses Git Large File Storage, all Git LFS objects are automatically moved.
This transfer occurs in the background, so if you have a large number of Git LFS objects or if the Git LFS objects themselves are large, it may take some time for the transfer to occur.

Before you transfer a repository that uses Git LFS, make sure the receiving account has enough data packs to store the Git LFS objects you'll be moving over.
For more information on adding storage for user accounts, see "Upgrading Git Large File Storage."

使用 Git LFS 2.9.0,如果您将其指定为绝对文件 URL,则可以从本地存储库克隆。不支持本地路径,但它们将在 Git LFS 2.10.0.

此外,如果您使用 Windows,目前需要使用 %3a 而不是冒号。你不是,但其他人是,这是问题的常见来源。这个要求也应该在 2.10.0 中消失。

所以基本上,您使用 Git 克隆的 URL 应该类似于以下内容:file:///home/nick/checkouts/somerepo.git.