首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >加载ssh-agent / git时,Powershell在启动时需要很长时间才能加载

加载ssh-agent / git时,Powershell在启动时需要很长时间才能加载
EN

Stack Overflow用户
提问于 2013-05-12 19:50:52
回答 3查看 2.6K关注 0票数 10

我将Powershell设置为通过Git for Windows使用posh-git。在我的配置文件中,我有以下内容:

代码语言:javascript
复制
# 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密钥的密码。这很好,但实际显示请求所需的时间越来越长。当我第一次以这种方式设置它时,它提示pass非常快,但加载时间随着时间的推移而增加。

有什么建议吗?我甚至不知道从什么开始调查这件事。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-06-05 19:42:19

问题确实在于用户环境变量的设置速度很慢。我最近合并了使用临时文件的a change

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

票数 5
EN

Stack Overflow用户

发布于 2013-06-03 17:32:51

我将这个问题追溯到这个:https://superuser.com/questions/565771/setting-user-environment-variables-is-very-slow

因为chrome有很多进程需要时间来响应,所以我简单地在我的profile.ps1中关闭了Chrome,如下所示。

代码语言:javascript
复制
$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
}
票数 3
EN

Stack Overflow用户

发布于 2013-05-13 00:46:19

我也遇到过类似的问题(没有密码请求)。重新安装有帮助。这是给here的建议

Eiter的方式,今天我完全删除了所有的posh-git痕迹(包括Microsoft.PowerShell_profile.ps1中的条目),并从源代码克隆了它。这为我解决了问题!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16507054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档