text 用于启动ssh-agent的powershell脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 用于启动ssh-agent的powershell脚本相关的知识,希望对你有一定的参考价值。
$ gcm start-sshagent | fl
Name : start-sshagent
CommandType : Function
Definition :
if($env:SSH_AGENT_PID) { echo "ssh-agent running"; return }
$private:gp = get-gitbinpath
if($private:gp) {
$private:out = & (join-path $private:gp "ssh-agent")
$private:out | ?{$_.contains("=")} | %{
$private:cur = $_.split(";")[0]
$private:pair = $private:cur.split("=")
$private:cmd = ('$env:{0}="{1}"' -f $private:pair)
invoke-expression $private:cmd
}
write-warning "Use exit to leave shell"
register-engineevent powershell.exiting -action {
ps -Id $env:SSH_AGENT_PID -ErrorAction SilentlyContinue | stop-process
} | out-null
}
$ gcm addkey-sshagent | fl
Name : addkey-sshagent
CommandType : Function
Definition :
if($env:SSH_AGENT_PID) {
$private:gp = get-gitbinpath
if($private:gp) {
& (join-path $private:gp "ssh-add") (join-path $env:USERPROFILE "/.ssh/id_rsa")
}
}
$ gcm get-gitbinpath | fl
Name : get-gitbinpath
CommandType : Function
Definition :
$private:gp = (gcm git -ErrorAction SilentlyContinue)
if($private:gp) {
$private:pth = split-path (split-path $private:gp.Definition)
return join-path $private:pth "bin"
}
return $null
以上是关于text 用于启动ssh-agent的powershell脚本的主要内容,如果未能解决你的问题,请参考以下文章
Linux 命令(211)—— ssh-agent 命令
sh 启动ssh-agent #ssh #ssh-agent #bashrc
我需要在每次启动时重新运行 eval(ssh-agent) 和 ssh-add
ssh-agent && 及 ssh-add介绍
python 以递归方式收集所有* .ppk,启动PAGEANT.EXE(Windows的ssh-agent)
启动 Pageant SSH-Agent 并加载文件夹中的所有密钥