git and Corporate Proxies

Recently, the eXPlainPMT project migrated from svn to git, hosted over at github.com.  This gave me a great opportunity to quickly learn git, especially considering that I had commits I wanted to apply.  GitHub is a great service – free OSS hosting, hosted forks, and a really useful visualization that shows the full history of forks with status messages.  The only piece I miss from Google Code (besides a painfully easy SVN setup) is the issue log.  However, they do expose commit hooks which Google didn’t, so there’s some integration with other online issue tracking tools.

First, about git.  There are infinitely better resources to look to on what git is and why it exists.  With that said, I’ll just quicky say that git rocks for OSS development.  When I was flying back from DC, I giggled like a Miley Cyrus fan when I did my first disconnected commit.  My mind is still trapped in centralized repository thinking, but this has always been my greatest complaint against them: offline commits.  Now it’s so trivially easy I can’t go back.  The other wonderful thing is that a checkout of the repository is the whole repo.  That means I can view the full history locally without hitting the server.  It also means that commits back to the parent repository (or a remote push in git-speak) are really quick.  Also, branching is really really cheap.

Now for the ugly: git is horrible in Windows.  I mean, god-awful.  “But Andy, why would you use Windows? OMG M$ 5uxorz!!!!11111elevendyone”  Because we have Windows laptops at work, and I need to be able to commit to the project while at work.  Git has a ways to go here to be as simple as SVN to install, and it would be cool to see some IDE integration, although it’s certainly not a requirement.

When I say it’s bad, the main reason is that there isn’t, at this point, a truely native build.  I’m using msysGit and PuTTY.  Throw into the mix our corporate proxy at work, and the pain goes up exponentially.  However, it’s not a lost cause.  Using instructions gathered from a ton of places, I have it up and running.  Finally.

  1. Get git!
    1. Follow the steps from github to get the binaries and generate your key
  2. Get PuTTY
    1. Go ahead and get the Windows installer version from here.
  3. Configure PuTTY
    1. First, we need to take the private key from step 1 and make it available to PuTTY
      1. Open PuTTYgen
      2. Click on Load
      3. Change the “Files of Type” dropdown to “All Files”
      4. Choose your private key file you created in step 1
      5. Enter your passphrase
      6. Go to File>Save Private Key and put it somewhere safe
    2. Next, we need to set up PuTTY to connect to github (or where ever)
      1. Create a new session called “github.com” with the host name set to “github.com”
      2. Set Connection>Proxy to whatever your corporate proxy settings should be
      3. Ensure that Connection>SSH>Auth has the “Attempt Authentication using Pageant” checked
      4. Go back to Session and save the session
      5. Click Open and make sure you get a login prompt.  If you do, close out.  If not, check your proxy settings.
    3. Now we need to give Pageant our key
      1. Open Pageant
      2. Click “Add Key”, navigate to your new PuTTY private key, and click OK.
      3. Enter your passphrase
  4. Perform a clone
    1. Using either Git Bash or Git GUI, clone a public repository from github.com (eXPlainPMT is a great place to start!)
    2. If you get errors about an invalid host or invalid passphrase, Pageant can’t find the session we created in step 3.2

Most of these directions are modified from what I found at CodeSlower and github guides.