Linux Git为每次推送输入长密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6106137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git enter long passphrase for every push
提问by jnbdz
Every time I try to push anything to GitHub it asks me the address [email protected]:...
and after that it wants the passphrase. Is there a way to automate this?
每次我尝试将任何内容推送到 GitHub 时,它都会询问我的地址[email protected]:...
,然后它需要密码。有没有办法自动化这个?
I am using Linux Ubuntu.
我正在使用 Linux Ubuntu。
采纳答案by El Yobo
You can use ssh-agent
to remember your passphrase (Gnome automatically runs this for you, normally...).
你可以ssh-agent
用来记住你的密码(Gnome 会自动为你运行这个,通常......)。
$ 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.
理想情况下,你会让它自动工作,所以在 gnome 中运行的所有 shell 都可以工作;查看Gnome 钥匙圈。
回答by Felipe
It is because you are using HTTPS (something like https://github.com/felipelalli/private.git) instead SSH (something like [email protected]:felipelalli/private.git).
这是因为您使用的是 HTTPS(类似于https://github.com/felipelalli/private.git)而不是 SSH(类似于 [email protected]: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
如果需要克隆 SSH,然后按照以下步骤授权您的机器:https: //help.github.com/articles/generate-ssh-keys
回答by James
Another way to use the ssh-agent
and ssh-add
commands to add your private identity to the authentication agent.
另一种使用ssh-agent
和ssh-add
命令将您的私人身份添加到身份验证代理的方法。
$ 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)