Created
February 18, 2010 00:48
-
-
Save davidlee/307200 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: see http://www.dribin.org/dave/blog/archives/2007/11/28/ssh_agent_leopard/ | |
# on leopard, DON'T run ssh-agent; just ssh-add and it will work. | |
export agentfile=/tmp/.ssh_agent | |
function start_ssh_agent() { | |
echo > $agentfile | |
chmod 600 $agentfile | |
ssh-agent > $agentfile | |
load_ssh_agent | |
} | |
function load_ssh_agent() { | |
source $agentfile > /dev/null | |
} | |
function load_or_start_ssh_agent() { | |
if [[ -f $agentfile ]]; then | |
load_ssh_agent | |
else | |
start_ssh_agent | |
fi | |
} | |
alias ssh-agent=load_or_start_ssh_agent | |
ssh-agent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment