Issue
ssh-agent, ssh-add all works on Cmder running PowerShell/Posh-Git
I have added
C:\Program Files\Git\usr\bin
Environment Variablesssh-keyen
works fine on Git Bash,how can I make ssh-keygen to also work with Powershell/Posh-Git ?
EDIT:
It turns out that the error is due to the fact that ssh-keygen in PowerShell is running the ssh-keygen.bat
file instead of ssh-keygen.exe
So setting an alias as mention below is the way to go.
I use Set-Alias
instead of New-Alias
because New-Alias
requires me to reset my $profile every now and then, which is weird.
To reset, type . $profile
Solution
One way to do this is to add it to your path.
Unfortunately, there appears to be no way to add only the executable. In other words, you will be required to add the whole bin
folder (namely C:\Program Files\Git\usr\bin
) to your path.
I can show you how to add the whole directory to the path, but I don't think this is what you want. Instead, below is an alternative method that only adds the ssh-keygen.exe
executable.
- Navigate to
$env:homepath\Documents\WindowsPowerShell
(create it if you don't have it). - Create a file called
profile.ps1
. - Add to the file the following line of code.
New-Alias Ssh-Keygen "C:\Program Files\Git\usr\bin\ssh-keygen.exe"
Now, each time you launch Powershell, Ssh-Keygen
will be available. It even works with tab completion (e.g. type ssh-
and press tab, then it automatically becomes Ssh-Keygen
).
Answered By - nehcsivart