Skip to content

Instantly share code, notes, and snippets.

@Mebus
Created January 23, 2017 21:19
Show Gist options
  • Save Mebus/a44fb9f5c12357dbb0a53223c7bafe52 to your computer and use it in GitHub Desktop.
Save Mebus/a44fb9f5c12357dbb0a53223c7bafe52 to your computer and use it in GitHub Desktop.
.profile for using the ssh agent with git on Windows
gent_running() {
[ "$SSH_AUTH_SOCK" ] && { ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]; }
}
env=~/.ssh/agent.env
if ! agent_running && [ -s "$env" ]; then
. "$env" >/dev/null
fi
if ! agent_running; then
ssh-agent >"$env"
. "$env" >/dev/null
ssh-add
fi
unset env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment