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?
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
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.To run ssh-agent with specified key I wrote this code:
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.
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
This has been fixed; see https://github.com/dahlbyk/posh-git/issues/160
You can update posh-git.