Powershell在加载ssh-agent/git时需要很长时间来启动加载

问题描述:

我有Powershell设置为通过Git for Windows使用posh-git。在我的个人资料文件中,我有这个:Powershell在加载ssh-agent/git时需要很长时间来启动加载

# If Posh-Git environment is defined, load it. 
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") 
. $env:github_posh_git\profile.example.ps1 

每当我打开Powershell,它都会为我的id_rsa密钥请求密码。这很好,但实际显示请求所用的时间越来越长。当我第一次以这种方式设置时,它提示通行速度很快,但是随着时间的推移,加载时间增加。

有什么建议吗?我甚至不知道该怎么看待这个问题。

+0

Posh-Git启动对我来说也很慢。看来我们并不孤单:https://github.com/dahlbyk/posh-git/issues/82 – 2013-05-12 16:29:08

的问题确实是用户环境变量的缓凝。我最近合并了使用临时文件的a change

最新的GH4W(1.0.48.0)包含此更改。

+0

我注意到它在上次更新后正确加载,没有真正看到这里的回复,并且你们已经确定了问题。谢谢你的帮助。 – 2013-06-14 10:32:17

我有一个类似的问题(没有密码请求)。重新安装帮助。它被赋予here建议:

Eiter方式,今天我完全除去豪华-混帐 (包括Microsoft.PowerShell_profile.ps1的条目)的所有痕迹,并从源头克隆 它。这解决了我的问题!

+0

嗨,谢谢你的回复。其实我想避免重新安装posh-git,这些东西在窗户上闪烁。但我注意到在本地> Github文件夹中的日志文件。 Log.txt现在非常大,我决定清空它。该提示立即加载。我不完全确定这是否是这个问题,但现在它会证明你的修复。 – 2013-05-13 11:27:58

+0

次要更新,日志文件不是问题,我仍然遇到减速,我想我会重新安装豪华。 – 2013-05-18 13:29:37

我跟踪这个问题到这一点:https://superuser.com/questions/565771/setting-user-environment-variables-is-very-slow

由于铬有许多过程,需要时间来反应,我只是在我的profile.ps1这样关闭浏览器。

$agent = Get-Process -Name ssh-agent -ErrorAction SilentlyContinue 
$chrome = Get-Process -Name chrome -ErrorAction SilentlyContinue 
$chromepath = $null 
if(!$agent -and $chrome){ 
    Write-Host "Chrome is open, press any key to close" 
    $host.UI.RawUI.ReadKey() | out-null 
    $chromepath = $chrome[0].Path 
    $chrome | Stop-Process 
} 
Start-SshAgent -Quiet 

if($chromepath){ 
    Start-Process $chromepath 
}