ssh-add创建连接到代理时出错:连接超时(Windows 10) [英] ssh-add creates Error connecting to agent: Connection timed out (Windows 10)
问题描述
我正在尝试将ssh添加到git中.我已经生成了它,〜/.ssh中有2个文件 在终端(MINGW64)中,我输入:
I am trying to add my ssh to git. I have generated it, there are 2 files in ~/.ssh In a terminal (MINGW64) I type:
$ eval "$(ssh-agent -s)"
它会回应:
Agent pid 3480
然后输入
$ ssh-add ~/.ssh/id_rsa
它响应(大约15秒后):
It responds (after like 15 secs):
Error connecting to agent: Connection timed out
整个代码(不运行ssh-agent.exe进程):
The whole code (with no ssh-agent.exe processes run):
MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master)
$ ls -al ~/.ssh
total 36
drwxr-xr-x 1 MNXALbl4 197609 0 июл 5 02:05 ./
drwxr-xr-x 1 MNXALbl4 197609 0 июл 5 02:08 ../
-rw-r--r-- 1 MNXALbl4 197609 3243 июл 5 02:05 id_rsa
-rw-r--r-- 1 MNXALbl4 197609 741 июл 5 02:05 id_rsa.pub
MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master)
$ eval "$(ssh-agent -s)"
Agent pid 12824
MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master)
$ ssh-add ~/.ssh/id_rsa
Error connecting to agent: Connection timed out
有什么想法吗?我尝试了所有可以找到的解决方案.
Any ideas? I tried all solutions I could find.
推荐答案
如果eval $(ssh-agent -s)
(不带引号)不能产生更好的结果(如此处所示),请不要忘记仅使用密码保护的SSH专用密钥才需要SSH代理.
If eval $(ssh-agent -s)
(without quotes) does not yield better result (as seen here), don't forget that the SSH agent is needed only for private SSH keys protected with a passphrase.
要进行测试,请在为Git设置简化的PATH
之后启动的git bash中尝试相同的命令:
For testing, try the same command in a git bash launched after setting a simplified PATH
for Git:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
set PATH=%PATH%;/path/to/ThreadScope/bin
情况并非如此,ssh -T git@github.com
返回预期的欢迎"消息,以验证您的身份验证.
This is not the case here, and ssh -T git@github.com
returns the expected "Welcome" message, which validates your authentication.
因此您可以忽略该ssh-agent
步骤,而直接进行其余工作:git clone git@github.com:anAccount/aRepo
,...
So you can ignore that ssh-agent
step, and simply proceed with the rest of your work: git clone git@github.com:anAccount/aRepo
, ...
这篇关于ssh-add创建连接到代理时出错:连接超时(Windows 10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!