$ ssh -T git@github - permission denied (public key)
I'm first time GitHub user. I installed Git for Windows, following instructions: http://help.github.com/win-set-up-git/
Came to the point of generating a public ssh-key. Opened Git Bash. Generated the key, saved it on github.com in my SSH Public Keys, now trying ssh access:
$ ssh -T git@github.com
Permission denied (publickey).
What's wrong? The instruction sais that everything should go fine. Maybe I need to reboot or wait开发者_如何学JAVA when github.com server gets to know my key?
Please help.
Thanks in advance!
You need to set up your ssh keys and then add your public key to your github account
ssh-keygen -t rsa
copy the key generated in the file ~/.ssh/id_rsa.pub (open with notepad)
paste this key in the "add ssh key" section of your github account
I had the same problem. Although every instruction was followed; Public Key genereated and added to my Github account, i kept getting the error...Until i restarted my machine. I suggest you do the same. Hopefully this should fix it.
Had to use exec ssh-agent bash
. It helped:
$ exec ssh-agent bash
bash-3.1$ ssh-add f:/GIT/.ssh/id_rsa
Enter passphrase for f:/GIT/.ssh/id_rsa:
Identity added: f:/GIT/.ssh/id_rsa (f:/GIT/.ssh/id_rsa)
bash-3.1$ ssh git@github.com
Hi MichaelZelensky! You've successfully authenticated, but GitHub does not provi
de shell access.
Connection to github.com closed.
For me (windows xp, reasonably fresh install) when generating the ssh keys via mingw32, the .ssh directory did not exist that I was saving the keys to.
Instead of ssh-keygen creating it, they were put in the root of the user directory (C:\Documents and Settings\).
This gave the Permission Denied (public key) error.
Simple solution...
Move the key files to the .ssh directory! (incidentally, this seemed to be created when I said yes to continue connecting after the authenticity of host.... message)
You need to generate your ssh key
first get to the ssh directory
cd ~/.ssh
Now generate a ssh key
ssh-keygen -t rsa -C "YOUREMAILID"
Key will be generated. Now install x-clip using this command
sudo apt install xclip
Now run the following command to copy the key to clipboard
xclip -sel clip < ~/.ssh/id_rsa.pub
replace id_rsa with the file location which you gave to save the key during generation now run the following command to know whether it is properly executed
ssh -T git@github.com
following message will occur
Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
now you are ready to perform any task in git without this issue...
I had the same problem, I generated my ssh-keygen, after I added my public key to GitHub, and they told me same problem, but what happens you need give permission to folder .ssh, I solve that problem, I know is basic make that, but I was foregetting that, but check it, maybe is the same solution.
sudo chmod 777 -R .ssh
精彩评论