Forums

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

Help with "Permission denied (publickey). fatal: Could not read from remote repository."

Julius Bangert May 1, 2018

I had everything working with the Sourcetree app and Bitbucket remote. A few days ago I could commit and push. Now, suddenly with no changes to the Sourcetree setup or remote setup I cannot push anymore.

Here is a screenshot of 'Pushing To Origin Full Output'. Can anyone suggest what to do?

Screen Shot 2018-05-01 at 18.22.30.png

1 answer

0 votes
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 1, 2018

Sierra or High Sierra? This is a remarkably common problem that users of those two specific revisions of macOS have, due to changes in the OS's handling of SSH identities. I suspect that most of the "related content" linked here is this exact issue.

Go to the Terminal and run `ssh-add -l` - your key should be listed there. If it isn't, run `ssh-add /path/to/key` (using the actual path to the private key, of course) and try again.

For a more permanent fix, update your ~/.ssh/config file to include a Bitbucket-specific stanza:

Host bitbucket.org
HostName bitbucket.org
IdentityFile /path/to/key
AddKeysToAgent yes
UpdateHostKeys yes
Julius Bangert May 1, 2018

Thanks for your reply.
I'm on macOS High Siera 10.13.4.

I did actually update my ~/.ssh/config file... 
This is what I see when I run pico ~/.ssh/configThere is an entry in there framed with a Sourcetree generated comment; any idea why it is not working.Screen Shot 2018-05-01 at 19.06.14.png

 

But when I run ssh-add -l I get The agent has no identities

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 1, 2018

The "Host" line (not HostName, just Host) needs to match the remote URL, otherwise the SSH client won't use that stanza. You'll either need to adjust your remote URLs to be that value ("user-Bitbucket:owner/repo.git") or change ~/.ssh/config to have "Host bitbucket.org" instead of what it has now.

Julius Bangert May 1, 2018

Great Thanks. I changed that as you suggested and I seem to be able to push to remote now.
I still don't understand it but it works so that's good. Thanks

Screen Shot 2018-05-01 at 19.38.08.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events