unable to curl a git tag

佐手、 提交于 2019-12-05 14:04:07
VonC

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

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

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!