I have set up the ssh key for my laptop following the GitHub docs. Then I was having trouble pushing or pulling because I had to write the passphrase every time. So, I followed this GitHub doc. Added the below code to my .bash_profile
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2=agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
agent_start
ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
ssh-add
fi
unset env
Now I have to write the GitHub pass every time I turn on my computer. Is there any way so that I do not have to write that passphrase every time I reboot?