Get archive link

Gets a redirect URL to download an archive for a repository. The :archive_format can be either tarball or zipball. The :ref must be a valid Git reference. If you omit :ref, the repository’s default branch (usually master) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request.

Note: For private repositories, these links are temporary and expire after five minutes.

GET /repos/:owner/:repo/:archive_format/:ref

Response

Status: 302 Found
Location: https://codeload.github.com/me/myprivate/legacy.zip/master?login=me&token=thistokenexpires

To follow redirects with curl, use the -L switch:

$curl -L http(s)://[hostname]/api/v3/repos/octokit/octokit.rb/tarball > octokit.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
100  206k  100  206k    0     0   146k      0  0:00:01  0:00:01 --:--:--  790k