Issue
I'm trying to run a dotnet build on my Jenkins build server. I keep getting the following error:
C:\Nuget\PackagesCache\gitversiontask\5.1.3\build\GitVersionTask.targets(10,9): error : LockedFileException: failed to lock file 'C:/jenkins/workspace/Shared-Build/.git/config.lock' for writing
And sometimes this message appear:
C:\Nuget\PackagesCache\gitversiontask\5.1.3\build\GitVersionTask.targets(10,9): error : LibGit2SharpException: failed to rename lockfile to 'C:/jenkins/workspace/Shared-Build/.git/config': Access is denied.
What interesting is that another team member can successfully run the build, without these errors appearing.
I tried to look online but no clear solution is available. This exception seems to be related to the gitversiontask Nuget package, but I'm using a fairly updated version of it. Did anyone ever encountered this error before?
Solution
Just for reference, this is a serious issue with parallel runners in GitVersionTask: https://github.com/GitTools/GitVersion/issues/1381.
Answered By - FranzHuber23
Answer Checked By - Pedro (JavaFixing Volunteer)