Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

error: cannot open .git/FETCH_HEAD: Permission denied

sodally November 19, 2019

I am using Sourcetree 3.2.6 and I have a Bitbucket account. I have suddenly run into an issue where I can no longer pull to one of my Windows machines. When I try to pull or fetch any repo I get the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
error: cannot open .git/FETCH_HEAD: Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied
error: cannot open .git/FETCH_HEAD: Permission denied
Completed with errors, see above.

From what I've seen this looks like my Windows user does not have permission to write to the directory, however, I can confirm that under Properties > Security the user groups I belong to have full access, and I have even added my account explicitly. I can add and remove files via explorer with no issues.

I've reinstalled Sourcetree with no luck. I've also tried moving the repo into various other directories (e.g. other drives/partitions, user folder, etc) without success.

I've had issues with my Bitbucket account not authenticating recently within Sourctree, but that is all working fine now. Clicking on Remote loads up the Bitbucket page for the repo with no issue. No red exclamation mark either.

Any ideas how I can get back to a working setup?

1 answer

0 votes
Fabio Racobaldo [Herzum]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 11, 2022

Hi @sodally ,

 

The Git “Cannot open .git/FETCH_HEAD: Permission denied” error occurs when you try to pull code from a remote repository when the .git/ directory in your project folder is inaccessible to your current user.

To solve this error, make sure that your current user has read-write privileges to the Git repository with which you are working.

Please check read/write/modify permissions of your user using the following article https://www.howtogeek.com/72718/how-to-understand-those-confusing-windows-7-fileshare-permissions/#:~:text=Modify%20allows%20you%20to%20read,attributes%2C%20owner%2C%20and%20permissions.

Hope this helps,

Fabio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events