如何隔离 msysgit 附带的 msys 实现中提供的 ssh-add/ssh-agent 的问题?
我已经安装了 msysgit:来自 http://code 的 Git-1.7.8-preview20111206.exe。 google.com/p/msysgit/downloads/list (编辑:我还安装了 msysGit-fullinstall-1.7.8-preview20111206.exe,这很方便安装到不同的目录,并且我在该实例中看到了相同的问题)。
我在 ssh-agent 方面遇到问题,其中 ssh-add 总是报告:“无法打开与您的身份验证代理的连接。”
不幸的是,ssh-add 没有向我提供有关它遇到的错误的任何进一步详细信息。当它尝试连接到套接字时,感觉好像超时了,但它实际上并不承认这是问题所在,并且 ssh-agent 的行为就像它正在正常运行一样。考虑到这种组合让我怀疑存在权限问题,但我不知道在哪里调查此类问题(而且我在 Windows 事件日志中没有看到任何我认为重要的内容)。
这个错误消息让我感到困惑:我有理由相信,如果我的环境变量设置不正确,我可能会收到此错误消息,但我有理由相信我的环境变量设置正确。我有理由相信,如果我的环境变量引用未运行的 ssh-agent 实例,但我恰好有一个 ssh-agent 实例正在运行并且它与我在环境变量中看到的内容相匹配,我可能会收到此错误消息。而且这是可重复的。我已经使用 ssh-agent > 等技术启动(并最终关闭)了数十个 ssh-agent 实例。 〜/ .ssh /环境; 。 ~/.ssh/environment
,以及 eval `ssh-agent`
和 ssh-agent bash
等等...而且我无法获取 msys ssh-添加以连接到 msys ssh-agent。
bash-3.1$ ps | grep ssh-agent
10304 1 10304 10304 ? 500 09:01:24 /bin/ssh-agent
bash-3.1$ bash -c 'set | grep SSH_A'
BASH_EXECUTION_STRING='set | grep SSH_A'
SSH_AGENT_PID=10304
SSH_AUTH_SOCK=/tmp/ssh-oAFwa11048/agent.11048
bash-3.1$ time ssh-add -L
Could not open a connection to your authentication agent.
real 0m10.730s
user 0m0.000s
sys 0m0.015s
bash-3.1$ wc /tmp/ssh-oAFwa11048/agent.11048
0 3 52 /tmp/ssh-oAFwa11048/agent.11048
bash-3.1$ cat /tmp/ssh-oAFwa11048/agent.11048; echo
!<socket >59261 060A4541-9831B739-519220DE-57936738
bash-3.1$
我还不关心编写任何脚本 - 我相信如果我可以从命令行让 ssh-add 工作,我就可以编写它的脚本......
还要注意 ssh-add 使用的 10 秒实时时间在发出“无法打开...”消息之前发生。
而且,我在这里使用的是当前版本的 Windows 7。而且,我还安装了 cygwin,但当我使用 msys 时它不在我的路径中。任务管理器显示我只有一个 ssh-agent 实例正在运行。正在运行的 ssh-agent 是 msys ssh-agent,是从 msysgit 的 bash 提示符启动的(路径中没有来自 cygwin 的任何内容)。 ssh 密钥是使用 cygwin 的 ssh-keygen 生成的,但表面测试表明 msys ssh 实用程序对该文件没有问题。 ssh-agent 不会给我任何错误消息或警告。
我可以使用 cygwin 的 ssh-agent,但是混合 cygwin 和 msys 会带来其他复杂性(您可以从我对此问题的描述中看到其中一些),并且我试图让 msys 在没有 cygwin 任何内容的情况下工作。
我需要做什么才能找出 msys ssh-add 不起作用的原因? (或者:我需要做什么才能使 ssh-add 正常工作?)
I have installed msysgit: Git-1.7.8-preview20111206.exe from http://code.google.com/p/msysgit/downloads/list (Edit: I have also installed msysGit-fullinstall-1.7.8-preview20111206.exe, which conveniently installs to a different directory, and I am seeing the same problems with that instance).
And I am having a problem with ssh-agent, where ssh-add always reports: "Could not open a connection to your authentication agent."
Unfortunately, ssh-add does not give me any further details on the error it encountered. It feels like it is timing out when it tries to connect to a socket, but it does not actually admit that this is the issue, and ssh-agent acts like it is running normally. Thinking about this combination makes me suspect a permissions issue, but I have no idea where I would look to investigate that kind of problem (and I do no see anything that I recognize as significant in windows event log).
This error message baffles me: I have reason to believe that I could get this error message if my environmental variables were not set up properly, but I have reason to believe that I have my environmental variables set properly. I have reason to believe that I could get this error message if my environmental variables refer to an instance of ssh-agent which is not running, but I have exactly one instance of ssh-agent running and it matches what I see in the environmental variables. And this is repeatable. I have started (and eventually shut down) dozens of instances of ssh-agent, using techniques like ssh-agent > ~/.ssh/environment; . ~/.ssh/environment
, and eval `ssh-agent`
and ssh-agent bash
and so on... and I cannot get msys ssh-add to connect to msys ssh-agent.
bash-3.1$ ps | grep ssh-agent
10304 1 10304 10304 ? 500 09:01:24 /bin/ssh-agent
bash-3.1$ bash -c 'set | grep SSH_A'
BASH_EXECUTION_STRING='set | grep SSH_A'
SSH_AGENT_PID=10304
SSH_AUTH_SOCK=/tmp/ssh-oAFwa11048/agent.11048
bash-3.1$ time ssh-add -L
Could not open a connection to your authentication agent.
real 0m10.730s
user 0m0.000s
sys 0m0.015s
bash-3.1$ wc /tmp/ssh-oAFwa11048/agent.11048
0 3 52 /tmp/ssh-oAFwa11048/agent.11048
bash-3.1$ cat /tmp/ssh-oAFwa11048/agent.11048; echo
!<socket >59261 060A4541-9831B739-519220DE-57936738
bash-3.1$
I am not concerned with scripting anything, just yet -- I believe that if I can get ssh-add working from the command line that I can script it...
And note also that the 10 seconds of real time that ssh-add uses happens before it issues the "Could not open..." message.
And, I am using a current version of windows 7, here. And, I also have cygwin installed, but it's not in my path when I am using msys. Task manager shows me that I only have one instance of ssh-agent running. The ssh-agent which is running is the msys ssh-agent, and was started from msysgit's bash prompt (without anything from cygwin in path). The ssh key was generated using cygwin's ssh-keygen, but superficial testing shows me that msys ssh utilities have no problem with the file. ssh-agent does not give me any error messages or warnings.
I can use cygwin's ssh-agent, but mixing cygwin and msys introduces other complexities (and you can see some of that just from my description of this issue), and I am trying to get msys working without anything from cygwin.
What do I need to do to find out why the msys ssh-add does not work? (Or: what do I need to do to get that ssh-add to work properly?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不能告诉你太多关于原因和方法的信息,但我可以告诉你我尝试过什么以及最终解决了什么问题。
在 git bash 中:
然后(在更改后的 shell 中):
这在一定程度上有效,我只需要输入密码一次,但我失去了正常的外观。经过更多搜索后,我在这个Github帮助页面<上找到了一个.bashrc脚本< /a>.
I can't tell you much about the why's and how's, but I can tell you what I tried and what finally solved it.
In git bash:
Then (in the changed shell):
That worked to a degree, I only had to type the passphrase once, but I lost the normal look. After some more searching I found a .bashrc script on this Github help page.