Skip to content

Instantly share code, notes, and snippets.

@sergii-bond
sergii-bond / ssh_add_identity.sh
Created June 20, 2017 20:19
Start SSH agent only once and add identity information without password prompt
SSH_ENV="$HOME/.ssh/environment"
KEY="$HOME/.ssh/id_rsa"
function start_agent {
# Starts the ssh-agent
# and adds its env vars into $SSH_ENV file.
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"