Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
meishi125478
ohmyzsh
提交
ce1fa4c1
O
ohmyzsh
项目概览
meishi125478
/
ohmyzsh
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
ohmyzsh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ce1fa4c1
编写于
6月 11, 2021
作者:
R
Robby Russell
提交者:
GitHub
6月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "ssh-agent: improvements (#6309)"
This reverts commit
a2062714
.
上级
a2062714
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
31 deletion
+10
-31
plugins/ssh-agent/README.md
plugins/ssh-agent/README.md
+2
-10
plugins/ssh-agent/ssh-agent.plugin.zsh
plugins/ssh-agent/ssh-agent.plugin.zsh
+8
-21
未找到文件。
plugins/ssh-agent/README.md
浏览文件 @
ce1fa4c1
...
...
@@ -19,17 +19,9 @@ To enable **agent forwarding support** add the following to your zshrc file:
zstyle :omz:plugins:ssh-agent agent-forwarding on
```
To
**NOT load any identities on start**
use the
`lazy`
style.
This is particularly usefull when combined with the AddKeysToAgent
(available from OpenSSH 7.2), since it allows to enter the password only
on first use.
```
zsh
zstyle :omz:plugins:ssh-agent lazy
yes
```
----
To
**load multiple identities**
use the
`identities`
style. This have no
effect if
`lazy`
is enabled.
To
**load multiple identities**
use the
`identities`
style, For example:
```
zsh
zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github
...
...
plugins/ssh-agent/ssh-agent.plugin.zsh
浏览文件 @
ce1fa4c1
lockdir
=
/tmp/oh-my-zsh-ssh-agent.lock
while
true
;
do
if
mkdir
"
$lockdir
"
2>/dev/null
then
# directory did not exist, but was created successfully
trap
'rm -rf "$lockdir"'
0
# remove directory when script finishes
break
# continue with script
else
sleep
0.1
# sleep for 0.2 and try again
fi
done
typeset
_ssh_env_cache
typeset
_agent_forwarding _ssh_env_cache
function
_start_agent
()
{
local
lifetime
...
...
@@ -68,7 +56,10 @@ function _add_identities() {
# Get the filename to store/lookup the environment from
_ssh_env_cache
=
"
$HOME
/.ssh/environment-
$SHORT_HOST
"
if
zstyle
-t
:omz:plugins:ssh-agent agent-forwarding
&&
[[
-n
"
$SSH_AUTH_SOCK
"
]]
;
then
# test if agent-forwarding is enabled
zstyle
-b
:omz:plugins:ssh-agent agent-forwarding _agent_forwarding
if
[[
$_agent_forwarding
==
"yes"
&&
-n
"
$SSH_AUTH_SOCK
"
]]
;
then
# Add a nifty symlink for screen/tmux if agent forwarding
[[
-L
$SSH_AUTH_SOCK
]]
||
ln
-sf
"
$SSH_AUTH_SOCK
"
/tmp/ssh-agent-
$USERNAME
-screen
elif
[[
-f
"
$_ssh_env_cache
"
]]
;
then
...
...
@@ -82,16 +73,12 @@ elif [[ -f "$_ssh_env_cache" ]]; then
ps
$FILTER
|
grep
ssh-agent |
grep
-q
$SSH_AGENT_PID
||
{
_start_agent
}
el
if
[[
-d
$HOME
/.ssh
]]
;
then
el
se
_start_agent
fi
if
!
zstyle
-t
:omz:plugins:ssh-agent lazy
;
then
_add_identities
fi
_add_identities
# tidy up after ourselves
unset
_ssh_env_cache
unset
_
agent_forwarding _
ssh_env_cache
unfunction _start_agent _add_identities
rm
-rf
"
$lockdir
"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录