Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bundle with LFS

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.

like image 301
A. Yeats Avatar asked Jul 30 '26 00:07

A. Yeats


1 Answers

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

like image 131
Chris Avatar answered Jul 31 '26 19:07

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!