Git Bash 在每次 PC 重新启动后首先 运行 要求输入 SSH 密码

Git Bash asks for SSH passphrase on first run after every PC reboot

每次我 Git Bash 重新启动 Windows 10 PC 后,它都会询问我的 SSH 密钥的密码。

我以前没有遇到过这个问题,在其他地方也没见过;我在工作中使用 Git Bash 并且从未在那里遇到过这个问题。

Initializing new SSH agent...
succeeded
Enter passphrase for /c/Users/User/.ssh/id_rsa:

如果我关闭 Git Bash window 并打开一个新的,新的 window 不会提示我输入密码。随后的 window 也不会。我是否在第一个 window 中输入密码似乎并不重要。

但是,如果我重新启动,第一个 Git Bash window 将再次提示我输入密码。

我已经尝试卸载并重新安装 Git。我也试过 运行 ssh-add -k path/to/key。两种方法都不起作用。

If I close the Git Bash window and open a new one, the new window doesn't prompt me for a passphrase.

那是因为您的 ~/.bashrc(在 %USERPROFILE% 下)must have launched the ssh-agent,它将在您的 Windows 会话期间缓存您的密码。
但是重启时Windows,需要重新输入密码