Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pushing in Sourcetree fails but works from shell

From Source Tree, I get:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/master:refs/heads/master

Pushing to Permission denied (publickey).

fatal: Could not read from remote repository.


But, if I copy that to the terminal, and it works fine.

I verified that ls ~/.ssh/id_rsa has the same key as found on bitbucket. And I've run 

ssh-add ~/.ssh/id_rsa which says "Identity added"


I'm running OSX 10.13.4, Source Tree 2.7.3, BitBucket Media Adapter 1.0.6.

My SourceTree preferences / accounts are set to OAuth/SSH but I've tried Oauth/HTTPS, Basic/SSH, and Basic/HTTPS but I still get the same error.


It use to work. And one time after playing with it for an hour, I got it to work again. But, now SourceTree fails again and I did't do a thing.


1 answer

0 votes
Manju Atlassian Team May 08, 2018

With ssh, please check if the ssh-agent has your keys loaded. If not, please add them to the agent. 

Run below commands in terminal to do so,

To check if keys are loaded:

ssh-add -l

To add keys to agent:

ssh-add <path_to_key>

more like,

ssh-add ~/.ssh/id_rsa

Key in the passphrase used while generating the ssh key and you should be good to go.


Sourcetree Mac Developer

I greatly appreciate your answer. But, I'm afraid I've tried that several times. I've followed every single help discussion I could find (dozens actually).  I've literally spent over an hour trying that sort of thing. And I can't get it to work in Source Tree.

Here's the thing... when I run the exact same git command in a shell, it asks me:

    Enter passphrase for key '/Users/myusername/.ssh/id_rsa'

But wait??? I've never given the passphrase to Source Tree!  So I don't understand how it can even work! Why doesn't Source Tree ask me for a passphrase?

Or, perhaps I shouldn't be prompted for a passphrase from the shell command at all? Is this a symptom of the problem? Maybe Source Tree or the shell should know my passphrase already.

I love the Source Tree software. It's wonderful. If I could only fix the checkin part, then I wouldn't have to always run git from a shell.

Thank you again for attempting to help me.

Manju Atlassian Team May 15, 2018

The passphrase it is asking you is for the key you have entered while creating the ssh key. We are aware that this prompt in Sourcetree isn't properly worded to let the user know that its the passphrase for ssh key. We are working to improve this experience in upcoming releases. 

If you don't remember this passphrase, you can create a new ssh key using Sourcetree and use that on the server. 

Let me know if you need help with that. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,155 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you