Since you are logging on to the command-line (presumably using SSH) all applications that you run, including ssh-agent
, stop when you log out.
In my opinion your best bet is to have your CentOS machine start ssh-agent
for you each time you log in, then manually use ssh-add
to add your key. This can be done by modifying your shell's login script. If you are using bash, this file is called ~/.bash_profile
. If you are using another shell, refer to its documentation and choose an appropriate file.
Edit one of these files and add eval "$(ssh-agent -s)"
at the end.
Now, each time you log in ssh-agent
should automatically start, and you can optionally run ssh-add
(since you are using a file that ssh-add
looks for by default you don't need to pass the file to the command) to add your key, then do Git stuff.
It sounds like you want to automate the adding of the key as well. This isn't something that I would choose to do since I like adding keys to be explicit, but because you don't have a passphrase on your SSH key you should be able to add ssh-add
to the same file we modified above (after we start the agent, of course) and have your key added automatically.
ssh-agent
run persistently. This will depend on your operating system. Please tell us what OS you are using, and which version. – Chrisssh-add
do you have to type a passphrase in)? – Chris