Repository.RemoveUntrackedFiles() : access denied

369 views Asked by At
Windows Server 2008 
McAfee Agent v4.8.0.1938 
no indexing service 
ASP.NET C# app 
libgit2sharp v0.21.0.176 NuGet package 

My ASP.NET app uses libgit2sharp Repository.Clone() method to clone a GitHub repo to local repo

Running my app tests on my local workstation, I perform various operations against this repo with no issues.

However, once my app is deployed to a remote server and hosted inside IIS , I'm encountering what appear to be either permissions or locking issues.

Repository.RemoveUntrackedFiles()

Exception thrown :

Failed to rename lockfile to 'c:/github/my-org/my-repo/.git/index': Access is denied.

If I re-attempt the operation it again fails but this time with a different exception :

The index is locked. This might be due to a concurrent or crashed process.

Subsequent attempts ( no matter how many ) fail with this same exception.

Issue is not resolved with iisreset or reboot.

If I re-create the local repo by going to cli and deleting local repo folder and then running git clone, I'm now able to successfully execute various git operations until I again attempt Repository.RemoveUntrackedFiles() at which point the above error-sequence re-occurs.

EDIT : I'm also encountering similar issues with

Repository.Checkout()

Exception thrown :

Failed to rename lockfile to 'c:/github/my-org/my-repo/.git/index': Access is denied.

I then go to the server and from the command line attempt git checkout master :

c:\github\opentable\service-ot-frontdoor-config>git checkout master
fatal: Unable to create 'c:/github/opentable/service-ot-frontdoor-config/.git/index.lock': File exists.

If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue.

0

There are 0 answers