How do I download a tarball from GitHub using cURL?

前端 未结 5 1550
旧时难觅i
旧时难觅i 2020-12-02 04:48

I am trying to download a tarball from GitHub using cURL, but it does not seem to be redirecting:

$ curl --insecure https://github.com/pinard/Pymacs/tarball/         


        
5条回答
  •  春和景丽
    2020-12-02 05:45

    The modernized way of doing this is:

    curl -sL https://github.com/user-or-org/repo/archive/sha1-or-ref.tar.gz | tar xz
    

    Replace user-or-org, repo, and sha1-or-ref accordingly.

    If you want a zip file instead of a tarball, specify .zip instead of .tar.gz suffix.

    You can also retrieve the archive of a private repo, by specifying -u token:x-oauth-basic option to curl. Replace token with a personal access token.

提交回复
热议问题