关于基于终端的远程配对编程的建议和一些软件工具
This is a small set of tools designed to provide a baseline environment for doing remote pair programming via SSH. The toolkit consists of:
While it can be cool to do remote screen-sharing, the sad fact is that pushing bitmaps across the wire takes a lot of bandwidth, and the user experience for the guest is... suboptimal. So, this project bundles up a reasonably usable set of terminal-based tools. Just think of it as retrocomputing and you'll be fine. :D
There's an excellent list of resources at pairprogramwith.me.
You may find this 10-minute tmux Quick Start screencast helpful.
When you're using tmux, it passes your keystrokes through to the programs it's managing for you. In order to send commands to tmux, you first have to get its attention by sending it the PREFIX key. By default, tmux uses Control-b as its PREFIX key, but the tmux.conf file included in this repository changes it to Control-\ (that's control-backslash).
This can be confusing to first-time users, so just to be clear, here's what you do:
Most tmux references will use the notation C-\ for Control-backslash. This document borrows the notation (( PREFIX x )) to represent the sequence "PREFIX combo, followed by x" from Brian Hogan's book about tmux: http://pragprog.com/book/bhtmux/tmux
wemux start. Either you're very
fast, or they forgot? :)wemux pair.Having a high-quality audio channel is critical to remote pairing. Strictly speaking, this is not something the ls-pair toolkit can set up for you, but here are some things to keep in mind:
Background Noise: Shared offices are loud. Grab a private room if you can.
External Speakers: Please don't use them unless you're certain that the sound won't feed back into your mic and bounce back to your partner. It's incredibly distracting.
Microphone: The mics built in to your Apple laptop or external display are tolerable if you're in a quiet environment. In big open-plan offices, though, they're useless. Please use a microphone that's close to your mouth, designed for use in noisy environments, or both.
If you already have a Skype-friendly headset, dig it out of your drawer. These can usually be purchased for under $20 on Amazon or from many big-box retailers.
If you have a pair of iPhone earbuds, the mic works reasonably well. They can be a bit uncomfortable for extended wear -- YMMV.
Bandwidth: Mics are the first step, but then your voice has to go through a series of tubes. Sometimes packets get dropped. There may not be much you can do about this in any given pairing session, but in the long term, try to avoid wifi networks with a lot of contention.
Software: I've had decent results with both iChat and Skype. Both are significantly better than the "voice chat" option built into, for example, join.me.
If it's an option, you might try working from home on days when you know you'll spend a significant amount of time doing remote pairing -- you may have a quieter environment and a better Internet connection, and you'll feel more comfortable speaking up when you aren't worried about distracting your coworkers with one half of an ongoing conversation.
If you have the hardware and bandwidth to support it, it can be surprisingly beneficial to have video while pairing. As social primates, our brains have dedicated significant resources to decoding body language. It can be helpful to run the A/V processing on a completely separate box so that your primary development machine is not slowed down. Also, having a dedicated screen for your partner's video feed makes it harder to cover them up with another window, which contributes to a telepresence effect.
LogMeIn's Hamachi is a reliable way of creating ad-hoc VPNs, but it's a bit annoying to admin. The set up process is described in this wiki page.
The rest of this section applies only to hosts. Guests only need to SSH to their host's machine.
Please enable SSH on your machine. In Lion, go to System Preferences --> Sharing and click on "Remote Login". Make sure the box is checked, and under "Allow access for:", check "All users". (If you want to whitelist only certain users, you will need to revisit this preference pane each time you add an account for a new pair-partner.)
You must add your pair partner's SSH public key to the 'public_keys' subdirectory. The file should be named '{desired_username}.pub', where 'desired_username' is the username your pair partner will use to log in to your machine.
You need to create a new account on your machine for each person with whom you wish to pair. First, make sure you know which username they will be using and verify that there is a matching public key in the 'public_keys' directory (see SSH above).
This repo includes a script, bin/create_pair_account, that will prompt
you for a username, create the account on your system, and set up the
account's '.ssh/authorized_keys' to include the key file in
'public_keys'. No need to worry about setting a password; OSX won't
allow password-based login for this account.
There is also a bin/create_all_pair_accounts command that will
provision a pair account for each SSH key in 'public_keys'.
As of Lion, Mac OS X's Terminal.app finally supports 256-color terminal emulation. However, iTerm2 has a number of other niceties that you may prefer. I've included a copy of my preferences file, with a few different color schemes, in com.googlecode.iterm2.plist; feel free to copy this somewhere. (You can point iTerm2 at this file by going to Preferences, General, "Load preferences from a user-defined folder or URL". I suggest copying the file elsewhere so that any changes you make don't accidentally get pushed back up into this repository. I have mine in Dropbox.)
The use of SSH and tmux basically limits your choices to terminal-friendly editors. (Unless you have some crazy GUI editor with a sharing protocol you can tunnel across SSH -- in which case, I'd like to see it!)
This project is just about getting two (or more) developers to share access to the same environment. It is editor-agnostic; each pair can negotiate whatever editor(s) they're comfortable using. (Note: as long as you make sure to reload your buffers, it's quite feasible to have vim in one tmux window and emacs in another.)
If you don't want to pull your hair out while fumbling through your pair's custom Vim bindings, you can toggle your Vim configuration with the provided set of configs:
bin/toggle_vim_configThis script creates a backup of your Vim config and symlinks the ls-pair
vimrc and vim directory. To toggle back to your configuration,
simply run the command again:
bin/toggle_vim_configThe MIT License
Copyright (C) 2012 LivingSocial
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, a
暂无开放 Issues,或尚未同步最近议题。