i use soureTree for clone ssh project.
when i print ssh -T ,i can make it success in the command line. when i git clone, pull ,push in ssh ways...It still works in the command line.(terminal)
but in sourcetree still get error now:
Permission denied (publickey)
how can i solve it?
Solution 1: Enable Password Authentication In the file, find the PasswordAuthentication line and make sure it ends with yes . Find the ChallengeResponseAuthentication option and disable it by adding no . If lines are commented out, remove the hash sign # to uncomment them. Save the file and exit.
"Permission denied (publickey)" and "Authentication failed, permission denied" errors occur if: You're trying to connect using the wrong user name for your AMI. The file permissions within the operating system are incorrect on the instance. The incorrect SSH public key (.
The “Permission denied (publickey). fatal: Could not read from remote repository” error is caused by an issue with the way in which you authenticate with a Git repository. To solve this error, make sure your key is being used on your Git account. If it is not, add your key to Git.
From Sourcetree, open the PuTTY Key Generator dialog by going to Tools > Create or Import SSH Keys. Click Load, navigate to your SSH folder, and click the private key. Make sure you're looking at All files if you don't see your private key. Enter your passphrase for the SSH key and click OK.
I downloaded SourceTree 2.7.6 and encountered same problem. I think @Frankie_0927 are right, private key must be named id_rsa and must be registered in ssh agent.
for other people encountered this problem: try generate a pair of key following the instructions in below link: https://help.github.com/articles/connecting-to-github-with-ssh/ store the private key id_rsa in ~/user/YOURUSERNAME/.ssh (path for mac) and post public key in github account. then run
ssh-add -l
you will see
The agent has no identities.
so you run
ssh-add -K ~/.ssh/id_rsa
to add the key into ssh agent. after this, run
ssh-add -l
again, you will see the key is added and the problem should be solved.
You are receiving this message because it could not authenticate you with any of the keys that were offered to it by your SSH agent. To verify this is the case, do the following:
ssh -T
This will attempt to create a connection to it for Mercurial. You should receive a response similar to the following if your key is correctly loaded.
If you do not see a message,this can be caused by a couple of factors, but these are the most common:
To check to see if your public key is loaded, do the following:
Open a browser and log into origin.
The SSH Keys page displays. It shows a list of any existing keys.
If you do not have any keys listed,set one up.
If your SSH agent doesn't know to offer a key, the connection will fail. To find out what keys your SSH Agent currently is offering, and add them, do the following:
$ ssh-add -l
Then, if you don't see your key listed, add it by
ssh-add ~/.ssh/identity
For more information, check out our full Troubleshoot SSH issues guide.
If you get the error "Permission denied", it is also possible that git or mercurial doesn't have permission to create the project folder locally. Check permissions for the directory where you're attempting to check out the project, and make sure you have write access.
1 Right click and "Run as Administrator".
2 Type ssh-keygen
3 Press enter.
4 It will ask you to save the key to the specific directory.
5 Press enter. It will prompt you to type password or enter without password.
6 The public key will be created to the specific directory.
7 Now go to the directory and open .ssh folder.
8 You'll see a file id_rsa.pub. Open it on notepad. Copy all text from it.
9 Go to https://gitlab.com/profile/keys .
10 Paste here in the "key" textfield.
11 Now click on the "Title" below. It will automatically get filled.
12 Then click "Add key".
Found that inside /var/log/gitlab/sshd/current there were multiple occurences of a message: Authentication refused: bad ownership or modes for file /var/opt/gitlab/.ssh/authorized_keys After which I changed ownership of that file from 99:users to git:users with: chown git:users authorized_keys
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With