简体   繁体   English

激活 virtualenvwrapper 并在登录时运行 ssh-agent

[英]Activate virtualenvwrapper and run ssh-agent on login

I want to activate virtualenvwrapper and start ssh-agent on start (so I can later add key using ssh-add)我想激活 virtualenvwrapper 并在启动时启动 ssh-agent(所以我以后可以使用 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.显然,这行不通,因为 exec 会取消 source 命令的效果。 So I'm stuck.所以我被困住了。 Every other solution I'm finding on stack overflow seems to include exec in one form or another :(.我在堆栈溢出中找到的所有其他解决方案似乎都以一种或另一种形式包含 exec :(。

You should be able to do你应该能够做到

eval $(ssh-agent -s)

instead反而

This will allow you to start ssh-agent without spawning a new shell.这将允许您在不生成新 shell 的情况下启动 ssh-agent。 In a new shell, your source command will be out of scope, but in the current shell, it should still apply.在新 shell 中,您的source命令将超出范围,但在当前 shell 中,它仍应适用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM