libgit2 / libgit2/libgit2sharp

Access Is Denied to log file

Open
#1,320 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Have an issue with this error message:

LibGit2Sharp.LibGit2SharpException: Could not open 'c:/../.git/logs/HEAD' for writing: Access is denied.

   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in c:\projects\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 160
   at LibGit2Sharp.ReferenceCollection.MoveHeadTarget[T](T target) in c:\projects\libgit2sharp\LibGit2Sharp\ReferenceCollection.cs:line 631
   at LibGit2Sharp.Repository.Checkout(Branch branch, CheckoutOptions options) in c:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 911
  • We tried restarting process, and restarting the machine, this didn't immediately fix issue.
  • It was only after deleting the entire folder, and making a new checkout that we could stop the error.
  • We were able to use git command line and source tree on the folder with no problems..

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the failing path through Core/Ensure.cs, ReferenceCollection.cs, and Repository.cs, then compare the reported checkout behavior with command-line Git and SourceTree. Done means identifying a reproducible cause for the denied write to .git/logs/HEAD and documenting or validating a fix for that scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.