I have a site as a remote Git repo pulling from Bitbucket.com using an SSH alias. I can manually start the ssh-agent on my server but I have to do this every time I login via SSH.
I manually start the ssh-agent:
eval ssh-agent $SHELL
Then I add the agent:
ssh-add ~/.ssh/bitbucket_id
Then it shows up when I do:
ssh-add -l
And I'm good to go. Is there any way to automate this process so I don't have to do it every time I login? The server is running RedHat 6.2 (Santiago).
ssh-agent <command>runs<command>as a subprocess ofssh-agent, so you're starting a new shell. I think you wanteval ssh-agent. – Barmar Sep 18 '13 at 20:53.bash_profileis specific to bash,.profileis generic to all POSIX shells.bashwill look first for.bash_profile, then default to.profile. – Barmar Sep 18 '13 at 20:54ssh-agentfor a "standard" (POSIX-compatible) shell iseval $(ssh-agent -s). Note also that you have to make sure you properly get rid of the agent when you log out, so it's also advisable to puttrap 'kill $SSH_AGENT_PID' EXITin your.profileafter the line which starts the agent. – kostix Sep 19 '13 at 10:16