title: Download zipball from github in C#
body: <p>Need to download a zipball from given link in C#</p>
  
  <p>YES! I searched the net and stackoverflow and been trying to accomplish this seemingly impossible task for hours...</p>
  
  <p>Ironically, in Curl it's single line and works like charm..</p>
  
  <pre><code>curl -L https://api.github.com/repos/username/reponame/zipball &gt; repo.zip
  </code></pre>
  
  <p>I want to do in C# same thing curl does above...</p>
  
  <p>Tried <code>WebClient.DownloadFile()</code> 
  Gives </p>
  
  <blockquote>
    <p>forbidden (403)</p>
  </blockquote>
  
  <p>Tried async method too 
  Gives </p>
  
  <blockquote>
    <p>0 bye file (no error/exception)</p>
  </blockquote>
  
  <p>Tried HttpClient Datadownload and File stream writer, give same errors as above. Seams like streamwirter is not invoked at all so it's failing to access the server that's the main part of my problem</p>
  
  <p>I have Octokit.NET installed but it lacks documentation so I'm not even sure where to start doing this (probably it's WebClient version but I did try that in .NET libs)</p>
  
  <p>Found this answer but didn't really understand it (<a href="https://stackoverflow.com/questions/29766916/cannot-get-repository-contents-as-zip-file-zipball-in-octokit-net">Cannot get repository contents as .zip file (zipball) in Octokit.net</a>)</p>
  
  <p>Even tried to run .sh script in C# but it gives me exception that it can't run this kind of shell on this OS</p>