简体   繁体   English

允许使用Cmder(ConEmu)转发代理

[英]Allow agent forwarding using Cmder (ConEmu)

I am using cmder which runs ConEmu on Windows 8.1. 我正在使用在Windows 8.1上运行ConEmu的 cmder

It has a built in Git functionality so I can pull/push git repositories in the console (like on a Linux console) 它具有内置的Git功能,因此我可以在控制台中拉/推git存储库(例如在Linux控制台上)

To authenticate I use a password protected SSH private key. 要进行身份验证,我使用受密码保护的SSH私钥。 If I do a git push With ConEmu, it will prompt me for the keys password each time. 如果我使用ConEmu进行git push ,则每次都会提示我输入密钥密码。 I can type 'start-ssh-agent' and enter my password once, and it will will auto-authenticate me in that ConEmu window, however if I close or open another window I need to run the command again. 我可以键入“ start-ssh-agent”并输入一次密码,它将在该ConEmu窗口中对我进行自动身份验证,但是,如果我关闭或打开另一个窗口,则需要再次运行该命令。

How can I start an ssh-agent that will authenticate my key in every ConEmu window? 如何启动一个ssh-agent,它将在每个ConEmu窗口中对我的密钥进行身份验证?

With the following snipped the SSH key is added during the startup of Cmder and the password has only be entered once per session: 用下面的剪断的SSH密钥Cmder和密码的启动过程中添加仅每个会话输入一次:

@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

Add the code to cmder/config/user-profile.cmd in the current Cmder version or to cmder/vendor/init.bat for older versions. 将代码添加到当前Cmder版本中的cmder/config/user-profile.cmd或旧版本的cmder/vendor/init.bat中。

Edit: Newer versions of cmder have the following lines in the user-profile.cmd which does the same using git: 编辑:较新版本的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"

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

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