Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 !

like image 730
craig Rickett Avatar asked Sep 03 '15 14:09

craig Rickett


2 Answers

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
like image 103
David Airapetyan Avatar answered Sep 21 '22 15:09

David Airapetyan


On Windows 10 this is what worked for me:

1. go to the repo folder 
2. right click on the .git folder and choose the last option - properties
3. on the general tab uncheck hidden checkbox if checked
4. hit apply and then ok

now go try git fetch or git pull and it should work.

like image 24
Akash Yellappa Avatar answered Sep 18 '22 15:09

Akash Yellappa