Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
737 views
in Technique[技术] by (71.8m points)

github - Having trouble downloading Git archive tarballs from Private Repo

I need the ability to download our application at specific tags, but I am unable to find a working solution for this. Downloading tarballs based on git tag seems promising but I am unable to get it working using Curl. I have tried the following but all I get back is the source for the github 404 page.

curl -sL https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m?login=$MY_USER_NAME&token=$MY_TOKEN > 0.2.0.257m.tar
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For public repo, you have this gist listing some examples:

wget --no-check-certificate https://github.com/sebastianbergmann/phpunit/tarball/3.5.5 -O ~/tmp/cake_phpunit/phpunit.tgz

For a private repo, try passing your credential information in a post directive:

wget --quiet --post-data="login=${login}&token=${token}" --no-check-certificate https://github.com/$ACCOUNT/$PRIVATE_REPO/tarball/0.2.0.257m

Or use a curl command as in SO question "git equivalent to svn export or github workaround", also explained in great details in:
"A curl tutorial using GitHub's API".


The OP Steven Jp reports having made the curl command work:

The final curl command ended up looking something like this:

curl -sL --user "${username}:${password}" https://github.com/$account/$repo/tarball/$tag_name > tarball.tar

(in multiple lines for readability)

curl -sL --user "${username}:${password}" 
  https://github.com/$account/$repo/tarball/$tag_name
  > tarball.tar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...