Activate virtualenvwrapper and run ssh-agent on login

691 views Asked by At

I want to activate virtualenvwrapper and start ssh-agent on start (so I can later add key using ssh-add)

Here is what I tried:

source /usr/bin/virtualenvwrapper.sh
exec /usr/bin/ssh-agent $SHELL

Obviously, this doesn't work, because exec will cancel the effect of the source command. So I'm stuck. Every other solution I'm finding on stack overflow seems to include exec in one form or another :(.

1

There are 1 answers

2
Farhan Kathawala On

You should be able to do

eval $(ssh-agent -s)

instead

This will allow you to start ssh-agent without spawning a new shell. In a new shell, your source command will be out of scope, but in the current shell, it should still apply.