Closed bcomnes closed 9 years ago
Just found https://github.com/lukesampson/askpass
Looks like the following gets this working in git-bash
~/.bashrc
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
if [ "$SSH_AUTH_SOCK" ]; then
# ssh-add returns:
# 0 = agent running, has keys
# 1 = agent running, no keys
# 2 = agent not running
ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]
else
false
fi
}
agent_has_keys() {
ssh-add -l >/dev/null 2>&1
}
agent_load_env() {
. "$env" >/dev/null
}
agent_start() {
(umask 077; ssh-agent >"$env")
. "$env" >/dev/null
}
add_keys() {
export SSH_ASKPASS=~/AppData/Local/scoop/shims/askpass.exe
export DISPLAY=localhost:0.0
/dev/null | ssh-add
}
if ! agent_is_running; then
agent_load_env
fi
# if your keys are not stored in ~/.ssh/id_rsa or ~/.ssh/id_dsa, you'll need
# to paste the proper path after ssh-add
if ! agent_is_running; then
agent_start
add_keys
elif ! agent_has_keys; then
add_keys
fi
unset env
Would you be open to shimming pshazz/*/libexec/askpass.exe so that its easier to get access too?
Cool, you found askpass. Yeah I don't mind the idea of including a shim for askpass.exe with pshazz. Do you want to submit a pull request?
Sure, I can do that. You don't understand how happy this makes me :laughing:
Hahaha!
Closing for now. Maybe I don't even need pageant support.
Storing the ssh decryption key in the windows credential manager is a brilliant setup.
Do you know if its possible, or which part of pshazz could be reused to enable an ssh-agent that works with git-bash or putty?