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 Sign up to answer
Community showcase
Published Oct 23, 2018 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...

710 views 3 2
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