关闭并打开新窗口后,SSH 密钥在 git bash 上不起作用

2024-03-18

使用以下链接创建 ssh 密钥 (https://help.github.com/articles/generate-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) 使用 git bash 创建 ssh 密钥并添加到 github 后。它仅适用于特定的 git bash。如果我关闭 git bash 并再次打开。相同的 ssh 密钥不起作用,需要创建新的。谁能告诉我为什么会这样?或者缺少什么?


当您打开 Git Bash 时,您需要自动将 ssh 密钥添加到每个会话。为此,如果您使用的是 Windows,请按照以下步骤操作:

  • 转到 Git 安装位置(通常位于C:\Program Files\Git\etc\ssh)
  • 编辑ssh_config文件并添加行IdentityFile Drive:\path\to\key where Drive:\path\to\key应指定之前生成的密钥的本地路径,并在编辑后保存文件。

现在,每次打开 Git Bash 时,密钥都会自动添加到 ssh 会话中,您无需每次都添加 ssh 密钥。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

关闭并打开新窗口后,SSH 密钥在 git bash 上不起作用 的相关文章

随机推荐