windows powershell 支援git ssh 配置
阿新 • • 發佈:2022-05-13
-
ssh-agent
從 Windows 服務啟動:
- 鍵入
Services
的Start Menu
或Win+R
,然後鍵入services.msc
啟動服務視窗; -
OpenSSH Authentication Agent
在列表中找到並雙擊它; - 在
OpenSSH Authentication Agent Properties
窗口出現,選擇Automatic
從Startup type:
下拉選單,然後單擊Start
從Service status:
。確保它現在說Service status: Running
。
-
配置Git的發出在PowerShell中的以下命令來使用Windows 10執行的OpenSSH:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
-
通過編輯在 中
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
-
ssh-agent
ssh-add
命令並輸入您的密碼將您的 SSH 金鑰新增到:
ssh-add $HOME/.ssh/your_file_name
- 完畢!如有必要,現在重新啟動 Powershell 甚至 Windows。