Last Updated: February 25, 2016
·
2.627K
· fsproru

Lost connection to ssh-agent in tmux

TL;DR

git clone git://github.com/wwalker/ssh-find-agent.git ~/.ssh-find-agent

# add to your .bashrc or .zshrc
source ~/.ssh-find-agent/ssh-find-agent.bash
if ! test $SSH_AUTH_SOCK; then
    set_ssh_agent_socket
fi

Long Version

Prerequisites
- Mac OS X
- tmux
- ssh key with passphrase

Problem
When I open a new tmux window or pane, I need to enter my passphrase every time I use ssh or pull from github. The reason is the connection to ssh-agent is lost in new tmux window.

Solution
Find and use the existing ssh socket inside a new tmux window.

https://github.com/wwalker/ssh-find-agent

1 Response
Add your response

I find tmux useful only on server as on Mac OS iTerm2 is more than enough (if you're pair programming, it's probably better to connect on server anyway). I had a LOT of problems similar to this when using locally (clipboard, scrolling, encoding etc.)

over 1 year ago ·