Git enter long passphrase for every push

后端 未结 3 742
傲寒
傲寒 2020-12-07 13:37

Every time I try to push anything to GitHub it asks me the address git@github.com:... and after that it wants the passphrase. Is there a way to automate this?

相关标签:
3条回答
  • 2020-12-07 14:14

    You can use ssh-agent to remember your passphrase (Gnome automatically runs this for you, normally...).

    $ ssh-agent bash
    $ ssh-add 
    Enter passphrase for /home/elyobo/.ssh/id_rsa: 
    Identity added: /home/elyobo/.ssh/id_rsa (/home/elyobo/.ssh/id_rsa)
    

    From now on, from within the terminal that you run this, your pass phrase will be remembered.

    Ideally you'd get it working automatically, so all shells running within gnome would work; check out Gnome Keyring.

    0 讨论(0)
  • 2020-12-07 14:19

    Another way to use the ssh-agent and ssh-add commands to add your private identity to the authentication agent.

    $ eval "$(ssh-agent -s)"
    Agent pid 1174
    $ ssh-add ~/.ssh/id_rsa
    Enter passphrase for /home/james/.ssh/id_rsa: 
    Identity added: /home/james/.ssh/id_rsa (/home/james/.ssh/id_rsa)
    
    0 讨论(0)
  • 2020-12-07 14:28

    It is because you are using HTTPS (something like https://github.com/felipelalli/private.git) instead SSH (something like git@github.com:felipelalli/private.git).

    If need to clone the SSH and then authorize your machine following theses steps: https://help.github.com/articles/generating-ssh-keys

    0 讨论(0)
提交回复
热议问题