简体   繁体   中英

Can not connect Github from my vps Ubuntu by ssh.

How can i connect my vps Ubuntu to Github via SSH? So i already add my public ssh key to the server by

ssh-copy-id

Now i can login my vps via ssh just fine. but when i run ssh git@github.com

i got

Permission denied (publickey).

and my .ssh folder already have this 2 folder

authorized_keys  known_hosts

I also added my public key to my github account. And ran this

git config --global user.name "myname"
git config --global user.email "myemail@domain.com"

i still got

Permission denied (publickey).

So how can i fix this?

Thanks!

You probably want to create a keypair on server:

ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa

Then add the public part ( ~/.ssh/id_rsa.pub ) to github using web interface (you don't have to remove the previous one you use from your computer).

And then you should be able to connect from your server using

ssh -vvv git@github.com verify

If not, post the log generated by the last command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM