通过以下 代码片段 ,可以在 Cmder 启动时添加 SSH 密钥,并且每个会话只需输入一次密码:
@echo off
ssh-agent | grep -v echo | sed -e "s/^/@set /" | sed -e "s/;.*$//" - > call.cmd
call call.cmd
del call.cmd
ssh-add "%HOME%\.ssh\id_rsa"
@echo on
cmder/config/user-profile.cmd
或旧版本的cmder/vendor/init.bat
中。
编辑:
较新版本的cmder在user-profile.cmd
中具有以下行,使用git执行相同操作::: uncomment this to have the ssh agent load when cmder starts
call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"
cmder\config\user-profile
。这个片段仍然非常有效! - mcalcote