Skip to content

Instantly share code, notes, and snippets.

@a5ync
Created April 20, 2016 00:16
Show Gist options
  • Save a5ync/5d7233caa14de6c6fc7ec96d515470b5 to your computer and use it in GitHub Desktop.
Save a5ync/5d7233caa14de6c6fc7ec96d515470b5 to your computer and use it in GitHub Desktop.
Download a lightweight Github .git-less snapshot (zipball) of a particular branch
$user = "user"
$pass= "password"
#zipballs of particular branches have syntax /repository-name/zipball/branch-name
$branchname = "master"
$linkToSnapshot = "https://github.com/a5ync/webgl/zipball/"+$branchname
#prepare credential header
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
Write-Host "Downloading snapshot"
Invoke-WebRequest -Uri $linkToSnapshot -Headers $Headers -OutFile 'snapshot.zip'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment