SSH-X is a collection of utilities around OpenSSH
- ssh-x - The main entry of all
ssh-xutilities.- ssh-x-agent-init - Start a singleton SSH agent and load private keys automatically
- ssh-x-env - Print the
SSHandSSH-Xenvironment ssh-x info- Get a 360 view of your SSH installation.- ssh-x-key - Manage your keys
- ssh-x-env - Get the environment information
- ssh-x-key-passphrase - Add or remove a key passphrase
- ssh-x-auth-proxy-command - An Ssh
ProxyCommandthat load automatically your private keys when you use your public key as identity - SSH_ASKPASS program
- ssh-x-askpass-prompt - Prompt for a secret from a terminal or GUI
- ssh-x-askpass-env - Echo a secret from an environment variable
You can install ssh-x with homebrew
brew install --HEAD gerardnico/tap/sshxIf you can't load a bash-lib library file, be sure to have the
variable SSH_BASHLIB_LIBRARY_PATH set with the directory of the bash-lib installation directory.
Because this library uses the linux ssh-agent (ie wsl),
it's not possible to pass the ssh-agent env (ie process id) directly with WSLENV.
Git therefore does not know that there is an agent running.
The solution is to:
- create a
gitwrapper at/usr/local/sbin/git - set this
gitexecutable as your git executable in your IDE
Example:
#!/usr/bin/env bash
# Load ssh-agent env
SSH_X_AGENT_ENV=$HOME/.ssh/ssh-x-agent.env
if [ -f "$SSH_X_AGENT_ENV" ]; then
source "$SSH_X_AGENT_ENV" >| /dev/null
fi
# Other SSH_X_ENV or source your env file.
export SSH_X_KEY_STORE="pass"
# Then git
/usr/bin/git "$@"Test from a Windows terminal
wsl --cd /path/to/a/git/repo git fetch originExample of a console git fetch with IntelliJ and pass as a private key store
19:30:39.727: [touch] /usr/local/sbin/git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --pruneOutput:
ssh-x-auth-proxy-command::main#71: Private Key is not in agent
ssh-x-auth-proxy-command::main#91: Adding Pass Private Key (ssh-x/id_git_github.com) to agent for a lifetime of 15m seconds
Identity added: /dev/fd/63 (email@email.com)
Lifetime set to 900 seconds
If you use pass as a private key store, you need to install a pgp gui pinentry.
Example with pinentry-qt.
sudo apt -y install pinentry-qtYou can set the env SSH_X_CALLERS_LOG to a directory and ssh-x will create
a log file each time the ssh:add function is called showing a prompt.
If you get this error from your IDE, this is because Git does not know your agent. See WSL GIT IDE Integration