Permission denied (publickey)

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

1 answer

0 votes
Jesse Yowell Atlassian Team Sep 19, 2017

Siva,

Is your public key loaded?

ssh-add -l

 

If you're on Windows is Pageant.exe loaded with the correct key?

Hi Jesse,

In the current environment that I work, I use bitbucket and sourcetree. I usually create a feature branch in bitbucket and then checkout using source tree.

Few days back , I had to change my login password. From that day I was unable to checkout into sourcetree. I tried to delete my local branches, and some how now I am encountered with lot of issues. 

 

Jesse Yowell Atlassian Team Sep 20, 2017

Siva,

Try and add your SSH key and then try again:

ssh-add -K ~/.ssh/span12-Bitbucket

Thanks a ton Jesse.

That is magic. Now I am able to checkout. :):)

 

Regards,
Siva

Jesse Yowell Atlassian Team Sep 20, 2017

No problem! An easier way to do this would be to add an entry to your config file, which would make it so you wouldn't have to add your key upon startup:

1. Create a file named "config" under your ~/.ssh/ directory

2. Add this entry:

Host *
  UseKeychain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/span12-Bitbucket

Hi Jesse,

 

I see "config" already in there. Here are the contents :

# --- SourceTree Generated ---
Host span12-Bitbucket
HostName bitbucket.org
User span12
PreferredAuthentications publickey
IdentityFile /Users/span12/.ssh/span12-Bitbucket
UseKeychain yes
AddKeysToAgent yes
# ----------------------------

But I don't see " Host * " should I need to add this ?

 

Regards,

Siva

Jesse Yowell Atlassian Team Sep 21, 2017

"Host *" would set the key to be used with any hosts you connect to. If you're only using the key for Bitbucket Cloud, then your entry is fine.

Here's another example of setting up multiple hosts with the same key file: https://unix.stackexchange.com/questions/16571/multiple-host-in-ssh-config

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

227 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot