Skip to content

Instantly share code, notes, and snippets.

@christianmlong
Created July 18, 2015 17:35
Show Gist options
  • Save christianmlong/bf261540c67585ea36c4 to your computer and use it in GitHub Desktop.
Save christianmlong/bf261540c67585ea36c4 to your computer and use it in GitHub Desktop.
Synchronise tmux's ssh env variables after reconnection
# Sync the environment of an existing shell
#
# tmux already updates the environment according to
# the update-environment settings in the config. However
# for existing shells you need to sync from from tmux's view
# of the world.
function tmux_sync_env
{
ssh_auth_sock=`tmux showenv | grep "^SSH_AUTH_SOCK"`
ssh_connection=`tmux showenv | grep "^SSH_CONNECTION"`
export ${ssh_auth_sock}
export "${ssh_connection}"
}
alias tse='tmux_sync_env'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment