Search code examples
gitgithubsshssh-keys

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 git@github.com

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.


Solution

  • 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 git@github.com..

    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