Skip to content

Instantly share code, notes, and snippets.

@wwqrd
Last active August 29, 2015 13:57
Show Gist options
  • Save wwqrd/9835144 to your computer and use it in GitHub Desktop.
Save wwqrd/9835144 to your computer and use it in GitHub Desktop.
Pairup blog post

Pairup

For the past few months I've been using tmux to manage my terminal sessions.

tmux is a terminal multiplexer, which allows you to manage multiple terminals within a single session.

One of the great features of tmux is session sharing. This means you can use it for pair programming if you both use a terminal-based text editor.

Using tmux for pair programming on a local machine (OS X)

To use tmux for pair programming we need to do a fair bit of manual legwork.

  • Create a tmux session
  • Make the session writable by other users (every time we create a session)
  • Set up a user
  • Enable "Remote login"
  • Connect the user to the tmux session on login
  • You are ready for an inbound connection at last!
  • At the end of our working session, we want to disable the remote login

Pairup gem

To smooth out the process I wrote a collection of scripts and packaged them up in a gem. With the gem installed the workflow becomes:

# Installation
$ gem install pairup
$ pairup setup                      # Create the `Pairup` user

# Run (host)
$ pairup auth <github username>     # Get the public ssh key for your colleague
$ pairup start

# Connect (client)
$ ssh pairup@<ip address of host>

# End session
$ pairup stop

Tunnelling

If the host is behind a LAN, you can use a service like ngrok.

# After running `pairup start` (host)
$ ngrok -proto=tcp 22

# Connect (client)
$ ssh [email protected] -p <ngrok port>

Remember, the guest user has the same access as the host, make sure you trust your partner.

Happy sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment