Powershell 中的 Git 提示“无法找到 ssh-agent”;
我安装了 git,它在命令提示符下运行得很好,但是当我打开 powershell 时,它给了我这个警告:
WARNING: Could not find ssh-agent
我正在运行选美比赛并加载了我的私钥。这适用于所有 GUI 工具和命令提示符,但不适用于 Powershell。
这是怎么回事?
I have git installed and it works great in the command prompt, but when I open up powershell it gives me this warning:
WARNING: Could not find ssh-agent
I have pageant running and loaded with my private key. This works in all the gui tools and the command prompt but not in Powershell.
What's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
对于那些寻求详细解释的人,请阅读此博客发布。以下是博客文章中的引用。最终,
ssh-agent.exe
需要位于路径中,或者以其他方式解析。编辑:
看来大多数人都懒得阅读链接的博客,并且原始摘录没有引用完整的解决方案,因此我扩展了下面博客中的引用。
根据对所有其他答案的喜欢,有多种方法可以解决该错误。下面引用了一种已知有效的方法。浏览其他答案,它们可能更适合您。
For those looking for a detailed explanation have a read of this blog post. Below is a quote from the blog post. Ultimately the
ssh-agent.exe
needs to be in the path, or resolved some other way.EDIT:
It appears most of the people don't bother reading the linked blog and the original extract did not quote the full solution, so I've expanded the quote from the blog below.
There are numerous ways to resolve the error, based on the likes to all other answers. One known to work is quoted below. Scan though other answers they may be more appropriate for you.
您可以在个人资料顶部添加两行(输入
ise $profile
)来修复此 PoshGit 问题,而不会污染您的路径。然后运行<代码>。 $profile 重新加载您的个人资料。对于 32 位 git
对于 64 位 git
You can add two lines to the top of your profile (type
ise $profile
) to fix this PoshGit issue without polluting your Path. Then run. $profile
to reload your profile.For 32-bit git
For 64-bit git
如果您使用 posh-git 并收到此警告,您可以通过注释(添加“#”符号)
文件中的以下行来关闭它
If you are using posh-git and getting this warning, you can turn it off by commenting (adding a '#' sign to) the following line
In the file
我想通了。您需要在计算机上设置
GIT_SSH
环境变量以指向plink.exe
。这可能是与 TortoiseHg / TortoiseGit / Git 扩展 一起安装的,或者您可以从 Putty 下载页面,但请确保您在系统范围内使用同一个。最好从 Windows 会话中注销,以确保为所有资源管理器实例和命令窗口设置此变量。I figured it out. You need to set
GIT_SSH
environment variable on your machine to point toplink.exe
. This could be the one installed with TortoiseHg / TortoiseGit / Git Extensions or you can download it from Putty Download Page, but just make sure that you use the same one system wide. Best to log out from your Windows session to make sure this variable gets set for all Explorer instances and command windows.为了使用指定的密钥运行 ssh-agent,我编写了以下代码:
To run ssh-agent with specified key I wrote this code:
此问题已修复;请参阅https://github.com/dahlbyk/posh-git/issues/160
您可以更新 posh-git。
This has been fixed; see https://github.com/dahlbyk/posh-git/issues/160
You can update posh-git.