17

我已经将一个 repo 复制到一个较新的 repo 中,但是在新 repo 上执行 git clone 时,它​​无法使用 LFS 指针下载文件,并且在使用 smudge 时出现错误......例如..“下载对象时出错。在服务器上找不到对象”

脚步:

git clone --bare https://github.com/myuser/old-repo.git
cd old-repository.git
git push --mirror https://github.com/myuser/new-repo.git

git clone https://github.com/myuser/new-repo.git
[error.....git-lfs.exe smudge --- somefile.....Error downloading object]

分支和提交历史看起来不错,但 LFS 无法下载所需的文件。使用 git-lfs 时还有其他方法吗?

4

3 回答 3

20

我发现了这个链接:mirroring-a-repository-that-c​​ontains-git-large-file-storage-objects

它似乎完全回答了你的问题。您错过的重要部分是git lfs push/pull

git clone --bare https://hostname/exampleuser/old-repository.git
cd old-repository.git
git lfs fetch --all
git push --mirror https://hostname/exampleuser/new-repository.git
git lfs push --all https://github.com/exampleuser/new-repository.git
于 2017-01-22T08:54:22.490 回答
2

钩子和插件等是 repo-local 配置,如果您的 git-lfs 设置在某种程度上难以第二次提交 repo-setup 脚本来执行它并在第一次结帐时运行它。

于 2017-01-18T17:36:47.097 回答
1

您也可以使用 git 协议进行克隆,LFS 资产仍将通过 http 拉下,这可能会根据您的 LFS 服务器产生密码提示,因为预共享的 sshs 密钥不会用于 LFS 资产的身份验证。

 git clone git@github.com:username/my_lfs_repo.git destination_dir
于 2017-01-20T05:52:13.427 回答