SSH Key - Still asking for password and passphrase

后端 未结 30 1455
孤街浪徒
孤街浪徒 2020-11-27 08:35

I\'ve been somewhat \'putting up\' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance w

30条回答
  •  广开言路
    2020-11-27 09:09

    Use ssh-add command to add your public key to the ssh-agent.

    ssh-add
    

    Make sure the ssh public key e.g. ~/.ssh/id_rsa.pub is what you have in your repo settings.

    Make sure you can actually ssh into the server e.g. For Bitbucket:

    ssh -T git@bitbucket.org
    

    Update the url to move from https to ssh. You can check which you use by checking the output of:

    git remote -v
    

    If you see a https:// in the urls, then you are still using https. To update it: Take the url and just replace https:// with ssh:// e.g. Change:

    https://git@bitbucket.org/../..
    

    To:

    ssh://git@bitbucket.org/../..
    

    Referenced: https://docs.github.com/en/github/using-git/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh

提交回复
热议问题