libgit2sharp: How can I get commits from a private repository?

72 Views Asked by At

I am using libgit2sharp 0.27.2 and can't figure out if I can set an access token/other way of accessing a private repostiry for my application, or how to do this.

I am doing this:

using(Repository repo = new Repository(GlobalsManager.url))
            {
                
                foreach(var commit in repo.Commits)
                {
                    Globals.LatestCommit = commit.Id.ToString();
                    Globals.Author = commit.Author.ToString();
                }
            }

Globals.cs is a class with globally used variables, and I use this code to update them on application startup. However, as I feared while writing this the application doesn't run and fails with RepositoryNotFoundException.

How can I circumvent this? I am trying to use the latest commit id and author in a Label on my WinForms Form. .NET version is 4.7.2, however I can update if needed. I saw some other posts similar to this, but they were old super old and didn't really answer me with something I can understand.

0

There are 0 best solutions below