use dynamic ssh agent
This commit is contained in:
parent
a31009b178
commit
71d2575ea8
1 changed files with 12 additions and 2 deletions
|
@ -53,9 +53,19 @@ in {
|
|||
export EDITOR=nvim
|
||||
export STARSHIP_CONFIG=/etc/starship.toml
|
||||
|
||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||
eval $(ssh-agent)
|
||||
if [ -f ~/.ssh/agent.env ] ; then
|
||||
. ~/.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
|
||||
|
||||
|
||||
set_win_title() {
|
||||
echo -ne "\033]0;$USER@$HOSTNAME: $PWD\007"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue