Having trouble downloading Git archive tarballs from Private Repo

后端 未结 3 1823
鱼传尺愫
鱼传尺愫 2020-12-03 00:05

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 b

相关标签:
3条回答
  • 2020-12-03 00:10

    Log into your Private Org on Github.com, then go here to create your token: https://github.com/settings/applications#personal-access-tokens

    When trying to Curl into your Private Org, use the following:

    curl --header 'Authorization: token ADDACCESSTOKENHERE' \
     --header 'Accept: application/vnd.github.v3.raw' \
     --remote-name \
     --location https://api.github.com/repos/ORG/PROJECT/contents/FILE
    

    Replace what's in CAPS with your information...

    0 讨论(0)
  • 2020-12-03 00:12

    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
    
    0 讨论(0)
  • 2020-12-03 00:26

    After creating an access token,

    you can use wget:

    wget --output-document=<version>.tar.gz \
        https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN>
    

    or curl:

    curl -L https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN> \
        > <version>.tar.gz
    

    More information can be found in GitHub's API reference for archive links.

    0 讨论(0)
提交回复
热议问题