Powershell takes a long time to load on start-up while loading ssh-agent / git Powershell takes a long time to load on start-up while loading ssh-agent / git powershell powershell

Powershell takes a long time to load on start-up while loading ssh-agent / git


The problem is indeed slow setting of user environment variables. I recently merged a change that uses a temp file instead.

The latest GH4W (1.0.48.0) includes this change.


I traced this problem down to this: https://superuser.com/questions/565771/setting-user-environment-variables-is-very-slow

Since chrome have many processes that takes time to response, I simply closed down Chrome in my profile.ps1 like this.

$agent = Get-Process -Name ssh-agent -ErrorAction SilentlyContinue$chrome = Get-Process -Name chrome -ErrorAction SilentlyContinue$chromepath = $nullif(!$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 -Quietif($chromepath){     Start-Process $chromepath}


I had a similar problem (without passphrase requests). Reinstalling helped. It is the advice given here:

Eiter way, today I completely removed all traces of posh-git (including the entries in Microsoft.PowerShell_profile.ps1) and cloned it from source. This solved the problem for me!