git GitHub for Mac 每次启动时都会弹出“输入你的 ssh 密钥 id_rsa 的密码”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11807175/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:18:28  来源:igfitidea点击:

GitHub for Mac pops up "enter your password for the ssh key id_rsa" at startup each time

gitgithubsshgithub-for-mac

提问by 1.21 gigawatts

It seems to show this dialog two or three times. If I cancel it goes away and I'm still able to commit changes.

这个对话框似乎显示了两三遍。如果我取消它就会消失,我仍然可以提交更改。

How do I prevent it from popping up each time and where do I find my passphrase if I have to reenter it and click "Remember to keychain" (which I've done before but will try again)?

如何防止它每次都弹出,如果我必须重新输入密码并单击“记住钥匙串”(我以前做过但会再试一次),我在哪里可以找到我的密码?

采纳答案by Ricardo Mendes

In the latest version of macOS - 10.12.2/Sierra - this is an easy fix. Just edit your ~/.ssh/config and enable the UseKeychain option:

在最新版本的 macOS - 10.12.2/Sierra - 这是一个简单的修复。只需编辑您的 ~/.ssh/config 并启用 UseKeychain 选项:

Host *
UseKeychain yes

Save and solved.

保存并解决。

回答by VonC

If your ssh key has been protected with a passphrase, then you need to run an ssh-agent first, in order to avoid entering said passphrase for every connections.

如果您的 ssh 密钥已被密码保护,那么您需要先运行 ssh-agent,以避免为每个连接输入所述密码。

See GitHub article "Working with SSH key passphrases".

请参阅GitHub 文章“使用 SSH 密钥密码”

Initializing new SSH agent...
# succeeded
# Enter passphrase for /c/Users/you/.ssh/id_rsa:
# Identity added: /c/Users/you/.ssh/id_rsa (/c/Users/you/.ssh/id_rsa)
# Welcome to Git (version 1.6.0.2-preview20080923)
# 
# Run 'git help git' to display the help index.
# Run 'git help ' to display help for specific commands.

If you don't have your passphrase anymore, it is better to re-create a new set of public/private ssh keys (protected, if you want, with a new passphrase), and publish that new public key on your GitHub account.

如果您不再拥有密码,最好重新创建一组新的公共/私人 ssh 密钥(受保护,如果需要,可以使用新密码),然后在您的 GitHub 帐户上发布该新公共密钥。

回答by chell

Ricardo's solution is correct for macOS Sierra v. 10.12.2. I still needed to enter the passphrase the first time I ran the ssh-agentprocess, but not again after that. If you are doing this in a terminal instead of a GUI, be sure to either restart your session or reinitialize it with . ~/.ssh/config

Ricardo 的解决方案适用于 macOS Sierra v. 10.12.2。我第一次运行这个ssh-agent过程时仍然需要输入密码,但之后就不需要了。如果您在终端而不是 GUI 中执行此操作,请确保重新启动会话或使用以下命令重新初始化它. ~/.ssh/config