优美短文

windows powershell 支持git ssh 配置

  1. ssh-agent从 Windows 服务启动:
  • 键入ServicesStart MenuWin+R,然后键入services.msc启动服务窗口;
  • OpenSSH Authentication Agent在列表中找到并双击它;
  • OpenSSH Authentication Agent Properties窗口出现,选择AutomaticStartup type:下拉菜单,然后单击StartService status:。确保它现在说Service status: Running
  1. 配置Git的发出在PowerShell中的以下命令来使用Windows 10执行的OpenSSH:git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe;

  2. 通过编辑在 中config找到的文件C:\Users\%YOUR_USERNAME%\.ssh\config,将SSH 配置为在启动时自动将密钥添加到代理,并添加以下行:

Host *
    AddKeysToAgent yes
    IdentitiesOnly yes

如果您使用自定义名称或多个 SSH 密钥生成了 SSH 密钥,您还可以添加以下行:

Host github.com
    HostName github.com
    User your_user_name
    IdentityFile ~/.ssh/your_file_name
  1. ssh-agent通过发出ssh-add命令并输入您的密码将您的 SSH 密钥添加到:
ssh-add $HOME/.ssh/your_file_name
  1. 完毕!如有必要,现在重新启动 Powershell 甚至 Windows。
posted @ 2022-05-13 11:37  一根PHP  阅读(434)  评论(0编辑  收藏  举报