ejhb
ejhb

Reputation: 35

ssh key github added still asking user/pw

I have first generate a key for my github. Then add it to and ID . Copy past the content of id_rsa.pub into my github account and test the connection with this command :

ssh -T [email protected]

followed by this :

The authenticity of host 'github.com (***.**.***.*)' can't be established.
RSA key fingerprint is SHA****:************************************.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,***.**.***.' (RSA) to the list of known hosts.
Hi ****! You've successfully authenticated, but GitHub does not provide shell access.

After this trying to push something, it still asking me my username and password I don't know why.

Upvotes: 2

Views: 577

Answers (3)

Hrishi
Hrishi

Reputation: 1434

Your current remote will be using https protocol. That is why it is still asking for password.

use git remote show origin | grep URL to see the current remote URL for origin

if it starts with https:// it will ask for username and password.

Then remove it by git remote rm origin

Then add ssh url by git remote add origin <url> Make sure that you provide ssh url here, it should be something like [email protected]..

Go to your github repo and click on green clone button and if it is in https format change it to ssh enter image description here

Use the Use SSH link to change it to SSH

Then you should see the ssh url

enter image description here

Upvotes: 3

ejhb
ejhb

Reputation: 35

All I want at this point is to no enter my username and password whenever I want to push my stuff on github. I made it work. But a day I had to create an other ssh key and id for my VPS but I overwrited it, I didn't know that I have to create one id/key per file.

So I delete known_host and erase the content of rsa.pub and rsa, and create a brand new one but it don't work..

Upvotes: 0

King Midas
King Midas

Reputation: 1699

Github does not provide SSH access. Your command is trying to connecto to github by ssh as connection to a remote computer. This is not what you are allowed to do.

What you can do with the SSH keys in github now, is clone repositories, commit, etc.

git clone [email protected]:<project>

And with SSH you are allowed to do actions on a project with the registered user. Now you can commit, perform pull requests, ...

Upvotes: 0

Related Questions