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.
Written by Alexander Tamoykin
Related protips
1 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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#