Powershell/PoshGit - '找不到ssh-agent'

arb*_*arb 13 git powershell

我已经Git-1.8.3-preview20130601.exehttps://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git安装了Git版本.我还安装了PoshGit,我使用的是Windows PowerShell.

当我启动PowerShell时,我得到了

警告:找不到ssh-agent

我能够进入ssh-agent.exe命令行并启动ssh代理.我也能够完成所有的Git命令,所以我的Git路径可能是正确的.

我一直在按照本指南让Git在Windows中正常工作.

我已经尝试过将他的建议添加$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"到我的Microsoft.PowerShell_profile.ps1文件中,但它没有用.它没有任何区别.我要寻找的建议其他比的解决方案.


为完整起见,这是我的Microsoft.PowerShell_profile.ps1文件

# Load posh-git example profile
. 'C:\Users\________\code\posh-git\profile.example.ps1'
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"
Run Code Online (Sandbox Code Playgroud)

G. *_*ard 27

您只需要在Microsoft.PowerShell_profile.ps1中反转这两行,以便包含posh-git配置文件之前更新PATH环境变量以包含Git bin路径.

在我的电脑上,这就是它的样子:我启动PowerShell并收到警告信息:

WARNING: Could not find ssh-agent
Run Code Online (Sandbox Code Playgroud)

我使用以下命令找到并编辑PowerShell配置文件$profile:

C:\Users\glombard> notepad $profile
Run Code Online (Sandbox Code Playgroud)

$env:path在加载posh-git示例配置文件之前更新以包含git的路径:

$env:path += ";${env:ProgramFiles(x86)}\Git\bin"

# Load posh-git example profile
. 'C:\tools\poshgit\dahlbyk-posh-git-22f4e77\profile.example.ps1'
Run Code Online (Sandbox Code Playgroud)