Reputation: 13850
I want to curl a git tag through the command line:
curl -O http://someurl
But when I try to untar the file it is broken? Do anyone know what is the problem?
Upvotes: 4
Views: 1761
Reputation: 60255
If you need to fetch only the minimum necessary,
git init temp
cd temp
git remote add x http://example.com/repo.git
git fetch x sometag --depth=1
git archive FETCH_HEAD > ../repo.sometag.tgz
cd ..
rm -rf temp
will do ya
Upvotes: 2
Reputation: 131841
git
itself doesn't provide a http-interface. A solution is to use git archive
instead
git clone http://example.com/myrepo.git
git archive mytag > myrepo-mytag.tar.gz
Upvotes: 3
Reputation: 1323613
You can curl
a git tag from a git repos hosting service like GitHub, because it has a dedicated tarball service (like Nodeload) which provides tar (or zip). But not any other git repo out there has that same service.
See "Having trouble downloading Git archive tarballs from Private Repo" for a concrete example with GitHub (or this curl
GitHub tutorial):
curl -sL --user "${username}:${password}" https://github.com/$account/$repo/tarball/$tag_name > tarball.tar
On a public repo:
curl -L https://github.com/pinard/Pymacs/tarball/v0.24-beta2 | tar zx
Upvotes: 4