Error on git pull error : cannot open .git/FETCH_HEAD: Permission denied

craig Rickett picture craig Rickett · Sep 3, 2015 · Viewed 32.6k times · Source

I'm looking for help !!

I am getting the following error message when trying to complete a git pull;

C:\Jenkins\Repo> git pull error: cannot open .git/FETCH_HEAD: Permission denied

The machine in question is Windows Server 2008 r2 OS and were using ssh to handle the authentication.

We have tried the following; Checked that the current user the correct read/write on the FETCH_HEAD file, which it does, also checking that the user has the correct permissions set on the repo root.

I have tried to load my private key (which I know 100% works and has permissions to the repo in question) and still the same issue... so from little I know regarding git I think this is more of a Windows issue

and lots of Google !

Any more ideas on what to do/check would be a great help !

Answer

David Airapetyan picture David Airapetyan · Sep 16, 2016

This happened to me after I upgraded to Windows 10. While my user is an administrator and Administrators had full access to the root repo folder, my user was not explicitly listed. I've added my user with Full Control and it solved the problem for me (had the same issue with Outlook refusing to read the PST file until I did the same thing).

So, for me, the solution is:

  • Right click on the folder, select properties
  • Security
  • Edit
  • Add
  • Type in my user name
  • Check Full Control under Allow
  • OK, OK