Enderbyte09
Enderbyte09

Reputation: 663

Proper C# Octokit method for authenticating to a private repository

I am writing a script to install a program. This program's source code is stored on a private GitHub repository. The binaries from the releases are also private. I also have an personal access token (Fine Grained Token) that according to the GitHub website grants me read-only access to all repositories, releases, metadata, etc. I am trying to enumerate the releases of a private repository using Octokit. This is my code:

 GitHubClient gc = new GitHubClient(new ProductHeaderValue("my-app"));
 var tokenAuth = new Credentials(Config.GithubToken);//The token, github_pat_XXXXXXXX...
 gc.Credentials = tokenAuth;
 var releases = await gc.Repository.Release.GetAll("ACompany", "Repository");
 var latest = releases[0];

When I run it, instead of getting the latest release, I get a long error the first line of which is

Unhandled Exception: Octokit.NotFoundException: repos/ACompany/Repository/releases was not found.
   at Octokit.ApiPagination.<GetAllPages>d__0`1.MoveNext() in /_/Octokit/Clients/ApiPagination.cs:line 34

Despite the fact that I have verified that the spelling and the key are correct, this error continues to appear. What is wrong?

Upvotes: 0

Views: 235

Answers (1)

Enderbyte09
Enderbyte09

Reputation: 663

It turns out that the Organization had not been properly configured.

Upvotes: 0

Related Questions