Duplicating a git repository and its GIT-LFS settings

时间:2016-07-11 20:19:44

标签: git github github-for-windows git-lfs

I've duplicated a repo into a newer repo but when doing a git clone on the new repo it's unable to download the files using the LFS pointers and I get an error when smudge is used... e.g... "Error downloading object. Object not found on server"

Steps:

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]

The branches and commit histories look fine but LFS fails to download the required files. Is there another method when using git-lfs?

3 个答案:

答案 0 :(得分:10)

我发现了这个链接:mirroring-a-repository-that-contains-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

答案 1 :(得分:2)

钩子和插件等都是repo-local配置,如果你的git-lfs设置在某种程度上很难做到第二次提交repo-setup脚本来执行它并在第一次检出时运行它。

答案 2 :(得分:1)

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

 git clone git@github.com:username/my_lfs_repo.git destination_dir