Reputation: 187
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?
Upvotes: 3
Views: 2736
Reputation: 4332
Just for reference, this is a serious issue with parallel runners in GitVersionTask: https://github.com/GitTools/GitVersion/issues/1381.
Upvotes: 1
Reputation: 2933
The solution was re-creating the config
and config.lock
(while keeping the worktree intact).
del .git\config
del .git\config.lock
And then use this command
git reset --mixed head
Upvotes: 1