Git Bundle with LFS
Asked Answered
H

2

5

I'm needing to bundle a git repo that we've been using git-lfs on but have run into an issue.

It will bundle up fine but when I come to clone it this error occurs

Downloading .../Dll's/DotNetZip.dll (458 KB) Error downloading object: .../Dll's/DotNetZip.dll (7dd20a2): Smudge error: Error downloading .../Dll's/DotNetZip.dll (7dd20a2291b05323bba04be4ae656d7635ae5e68a5a6fa2b9f86e27841846a31): batch request: missing protocol: "C:/...bundleName.bundle.git/info/lfs"

Errors logged to C:/.../.git\lfs\logs\20180831T093319.3979074.log Use git lfs logs last to view the log. error: external filter 'git-lfs filter-process' failed fatal: ../Dll's/DotNetZip.dll: smudge filter lfs failed warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'

I can't seem to find any documentation on how lfs should work with git bundle. All i really need for my lfs file is to store the latest version in the bundle but can't seem to find out where that could be either.

Handtomouth answered 31/8, 2018 at 8:45 Comment(1)
Thi link github.com/git-lfs/git-lfs/issues/1755 should help you in someway. From my understanding, there is not a full support in git-lfs of the command bundle.Guinn
S
3

Got same error in Ubuntu-20.04.1-LTS which still come with an oldish git-lfs version 2.9.

The error is mentioned in github.com/git-lfs and a fix is in git-lfs 2.10 or newer (at this time latest version is 2.13.2) and to install it these steps should be followed (see also wiki):

sudo apt install curl
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
git clone [email protected]:project/repo.git --recursive
cd repo/
git lfs install
git checkout some_branch

The error disappeared after that.

Syzran answered 25/1, 2021 at 11:41 Comment(0)
B
3

I believe git bundle isn't supported by git-lfs. However, with recent versions of git-lfs you can use local "bare" type git repos instead of a web-based repo manager like GitHub or GitLab.

To create a "bundle" of a git repo including its lfs data from GitHub using a local bare repo:

First, clone the repo from GitHub and fetch everything:

git clone https://github.com/some-user/lfs-repo
cd lfs-repo
git fetch --all
git fetch --tags
git lfs install
git lfs fetch --all

Then create a new bare repo:

cd ..
mkdir bare-repo
cd bare-repo
git init --bare

Then add the new bare repo as a remote to your cloned repo and push everything to it:

cd ../lfs-repo
git remote add bare file://$(pwd)/../bare-repo
git push --all bare
git push --tags bare
git lfs push --all bare

Now you have all the data (including the lfs data) in your bare-repo. You can zip it now:

cd ..
tar -czvf bundle.tar.gz bare-repo

If you want to retrieve the data from the "bundle", simply copy the file to the desired host, extract it and clone from it using the file:// URL.

References: Link1, Link2

Blinnie answered 20/11, 2021 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.