title: PowerShell : retrieve file from GitHub
body: <p>I need to download a file from my GitHub private repo.  So following the instructions on the GitHub site, I created an OAuth token for my credentials.</p>
  
  <p>Then I executed this PS script :</p>
  
  <pre><code>$WebClient = New-Object -TypeName System.Net.WebClient
  $WebClient.Headers.Add('Authorization','{OAuth token}')
  $uri = "https://github.com/mycompany/myrepo/blob/master/myfile.zip"
  $targetPath = "c:\temp"
  $WebClient.DownloadFile($uri, $targetPath)
  </code></pre>
  
  <p>However, <code>$WebClient.DownloadFile()</code> returns a 404.  This is strange because I can retrieve the file from <code>$uri</code> via a browser logged-in to GitHub with same credentials used to create OAuth token.</p>