use dynamic ssh agent
This commit is contained in:
parent
a31009b178
commit
71d2575ea8
1 changed files with 12 additions and 2 deletions
|
@ -53,10 +53,20 @@ in {
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
export STARSHIP_CONFIG=/etc/starship.toml
|
export STARSHIP_CONFIG=/etc/starship.toml
|
||||||
|
|
||||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
if [ -f ~/.ssh/agent.env ] ; then
|
||||||
eval $(ssh-agent)
|
. ~/.ssh/agent.env > /dev/null
|
||||||
|
if ! kill -0 "$SSH_AGENT_PID" > /dev/null 2>&1; then
|
||||||
|
echo "Stale agent file found. Spawning a new agent. "
|
||||||
|
eval `ssh-agent | tee ~/.ssh/agent.env`
|
||||||
|
ssh-add
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Starting ssh-agent"
|
||||||
|
eval `ssh-agent | tee ~/.ssh/agent.env`
|
||||||
|
ssh-add
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
set_win_title() {
|
set_win_title() {
|
||||||
echo -ne "\033]0;$USER@$HOSTNAME: $PWD\007"
|
echo -ne "\033]0;$USER@$HOSTNAME: $PWD\007"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue