Reputation: 448
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 !
Upvotes: 18
Views: 42186
Reputation: 1
This problem can also be caused by the caches Jenkins keeps of it's Git operations. I had tried chown
ing the files I thought were causing the problem, I also deleted the workspace completely.
After deleting %ProgramData%\Jenkins\.jenkins\workspaces\MY-BUILD*
I still had the exact same error message.
In %ProgramData%\Jenkins\.jenkins\caches
I deleted everything but you could probably just delete the git-<HEX_ID>
and git-<HEX_ID>@tmp
folders and retry the same checkout. This resolved the issue for me as Jenkins was forced to recreate the .git
folder in both the workspace and the cache and the permissions were then correct.
Steps:
Upvotes: 0
Reputation: 3396
What I did was open powershell / command prompt with Administrative rights inside the repository, and I was able to pull / fetch / merge and push.
Upvotes: 0
Reputation: 21
This happened to me because after updating windows. Kindly try these steps:
This will work for you
Upvotes: 2
Reputation: 2324
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.
Upvotes: 9
Reputation: 661
In my case, this happend because I hide the .git
folder by hand(usually it will be hide automatically) but I forgot it.
I have tried edit security but no effect. So I just show the .git
folder and solve the problem.
May this can be help for someone
Upvotes: 2
Reputation: 5610
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:
Upvotes: 23
Reputation: 1897
This is fairly a common problem. I've come across it many times and almost all of the times, the issue is with the right permissions to the repo/directory .git/
and the right SSH keys to access the git repository.
You probably need to make the user, the owner of the repository chown
(Give full access to the user) or, clone the repository to a different directory.
You can set the write permission with the following command
go to your folder chown -R youruser:yourgroup .git/
Also try to un-hide the .git folder.
Upvotes: 3