Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Github Permission denied (publickey) Edited

Hi, I downloaded SourceTree 2.7.6 today, and encountered below error, so I am denied access to all remote git operations with sourcetree.

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

 Please make sure you have the correct access rights

and the repository exists.

 FYI, my github account is added in SourceTree with Oauth, my ssh keys are well setted in local directory and in github account,  and I can do all remote git operation in terminal using commands.

Please help me with this issue, Thank you!

 

 

EDIT: 

problem solved after adding the key to ssh agent using below command

$ ssh-add -K ~/.ssh/id_rsa

BUT!!!!!!!!!!

 after some experiment I think the private key must be named  id_rsa for SourceTree to work, which is an inconvenience and should be solved by sourcetree developers!!!!!!!

2 answers

0 votes
bgannin Atlassian Team Aug 31, 2018

Sourcetree will respect whatever keys are loaded in your user environment and the configuration file contents, it isn't doing anything special beyond that. The SSH key management we introduced will generate and configure SSH keys for each service + account and use that if configured, otherwise it will default to id_rsa. Unfortunately macOS has a habit of forgetting loaded SSH keys which is a quirk introduced in 10.12.

Brian Ganninger
Senior Mac Developer, Sourcetree

Thanks for the reply. Unfortunately, I couldn’t find where to configure the ssh keys. There are no ssh key management options in the preferences&settings.

What you need to do is set it in the config file in your .ssh folder to use the right key when talking to the right domain.  'config' is just a plain text file that the SSH Agent uses to know which keys to use where.

In the case of GitHub you should have something that looks like this:

Host GitHub
    HostName github.com
    IdentityFile /<path>/<to>/.ssh/<YOUR KEY TO USE>
    UseKeychain yes
    AddKeysToAgent yes

You can then set different keys to use with different domains and servers.

The other thing that is critical is to make sure you add the key you create to the Agent's list of keys like you did in your edit.

- Grant

As a followup to the answer above, anytime I go to a repo on GitHub.com (HostName) it will use the key I provide a path to (IdentityFile) to make the SSH connection.

Suggest an answer

Log in or Sign up to answer
TAGS
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...

3,261 views 4 5
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