0

Just started "playing" with LibGit2Sharp and I already have an issue accessing the list of branches from my local repository. The goal is to access Git (for now just to get the list of branches) from my webservice.

[WebMethod]
    public string GetStringOfBranches()
    {
        string gitPath = @"C:\Users\MyUser\Documents\MyRepository";
        using (var repo = new Repository(gitPath))
        {

            //Console.WriteLine("start");
            foreach (var branch in repo.Branches)
            {
                Console.WriteLine(branch.FriendlyName);

            }

        }
}

If I run the project in debug mode or from my test project, it works fine. If I publish it to IIS ... the game is over, I get the error "LibGit2Sharp.RepositoryNotFoundException: Path 'C:\Users\MyUser\Documents\MyRepository' doesn't point at a valid Git repository or workdir. at LibGit2Sharp.Core.Proxy.git_repository_open(String path) at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) at WebSrv3.wsGitInterface.GetStringOfBranches() in C:\Users\MyUser\Documents\Visual Studio 2017\Projects\WebSrv3\WebSrv3\MyWs.asmx.cs:line 58".

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Idoneus
  • 76
  • 1
  • 7
  • 1
    Does the repository exist on the server that is running IIS? And if so, does IIS have permission to access the repository directory? – Robin Green May 25 '18 at 21:47
  • 1
    Thank you for redirecting my eyes!!! The repository is on the server but the IIS didn't have permissions, but now it has and IS WORKING!!!! – Idoneus May 25 '18 at 22:16
  • Please refer answer [Can't Open Remote repository on network web server](https://stackoverflow.com/questions/19823517/cant-open-remote-repository-on-network-web-server) – Gajanan Kulkarni Dec 11 '19 at 09:19

0 Answers0