Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sourcetree can't pull: error: cannot open '.git/FETCH_HEAD': Permission denied

Tara Stewardson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 24, 2023

Hi,

I have been using Sourcetree (3.4.8) to pull from Bitbucket data center for a long time, but recently have had issues with it and it is no longer working.

No recent updates, but a little while ago Sourcetree wouldn't open (the blue logo came up but nothing happened). A reinstall fixed the issue, but after reconfiguring, Sourcetree stopped being able to pull anything and threw the error:

“git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch --no-tags 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.”

I am able to successfully pull from the same repo in a Git Bash terminal (same SSH key as well), so I am not sure what's going on. 

I have had a look at the logs, but it is not obvious where this error occurs.

Any help is much appreciated, even just on where to look for more info.

1 answer

0 votes
LynnG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 11, 2026

Because Git Bash can pull successfully but Sourcetree cannot, this is unlikely to be an SSH key or Bitbucket problem. The error specifically indicates that Sourcetree cannot write to the local repository's .git/FETCH_HEAD file. [stackoverflow.com], [community....assian.com]

A few things I'd check:

1. Check file/folder permissions on .git

Navigate to the repository and inspect:

Plain Text
1
<repo>\.git\FETCH_HEAD
Show more lines

and the entire .git folder.

Make sure your Windows user account has Modify or Full Control permissions. Several reports of this error were ultimately caused by Windows permissions on the repository or .git directory. [stackoverflow.com], [stackoverflow.com]

2. Check whether FETCH_HEAD is locked by another process

Since Git Bash works and Sourcetree doesn't, it's possible another process is holding the file open for Sourcetree's Git process.

Try:

Shell
1
del .git\FETCH_HEAD
Show more lines

(or delete it from Explorer)

FETCH_HEAD is recreated automatically on the next fetch. [golinuxcloud.com], [codemia.io]

Also check for:

Plain Text
1
.git\FETCH_HEAD.lock
Show more lines

and remove it if present while Git is closed.

3. Compare the Git executable Sourcetree is using

After reinstalling, Sourcetree may have switched from System Git to its Embedded Git.

In:

check whether it's using:

  • Embedded Git, or
  • System Git

Since Git Bash works, try setting Sourcetree to the same System Git installation used by Git Bash.

4. Run Sourcetree as Administrator once

Not necessarily as a permanent fix, but as a diagnostic test.

If the fetch succeeds when run elevated, that strongly suggests a Windows permissions/ownership problem with the repository folder. [stackoverflow.com]

5. Compare repository location

If the repo is under a protected folder such as:

Plain Text
1
C:\Program Files\
2
C:\\
Show more lines

or a synced folder with special permissions (OneDrive, network share, etc.), try cloning the repository into a simple location such as:

Plain Text
1
C:\Repos\
Show more lines

and test there. Permission-related FETCH_HEAD issues are commonly tied to repository ownership or location. [stackoverflow.com], [golinuxcloud.com]

Most likely culprit

Given your timeline:

  1. Sourcetree stopped opening.
  2. Reinstall fixed startup.
  3. Git Bash still works.
  4. Sourcetree alone gets cannot open '.git/FETCH_HEAD': Permission denied.

My first suspicion would be that the reinstall changed Sourcetree's Git configuration (Embedded vs System Git) or Sourcetree is running under a different permission context than before.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events