I see that the download path for a GitHub repo is of the form
https://github.com/{username}/{reponame}/archive/{branchname}.zip
For a priva
See this guide on creating a personal access token then run the following:
var githubToken = "token";
var request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/$OWNER/$REPO/contents/$PATH");
request.Headers.Add(HttpRequestHeader.Authorization, string.Concat("token ", githubToken));
request.Accept = "application/vnd.github.v3.raw";
request.UserAgent = "test app"; //user agent is required https://developer.github.com/v3/#user-agent-required
using (var response = request.GetResponse())
{
var encoding = System.Text.ASCIIEncoding.UTF8;
using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
{
var fileContent = reader.ReadToEnd();
}
}