Monday, January 9, 2012

Git Windows is so easy!

[UPDATED 2014-10-07] For a pure msysgit experience, check out Basic Git Work Flow.
[UPDATED 2013-04-11]
I feel I should update this site since it is so hopelessly out of date.
I got Git up and running on an XP with shell integration, and linked to my remote in under 15 minutes, and that's only because I got up to get a cup of water. Now I have it running on my Windows 7 x64 machines as well. As the msysgit project has matured, it has gotten even easier. And there are more Git clients now as well. Git is the most widely used distributed version control system and not just for source control management tool, even writers and others are using it. Why? GitHub, Bitbucket, Gitorious, CodePlex and others all host online Git repositories. Mercurial is also a very popular dvcs.

Here are some notes I took of my process. I'll clean it up later:

mysysgit

There is really no need to read any of these other than Scott Chacon's Pro Git book.
  1. For more info. Read: Github Help: Set up Git , SparkFun: Using GitHub with Windows , Sergio Pereira » Git, SSH, PuTTY, GitHub, Unfuddle, the kitchen sink, and An Illustrated Guide to Git on Windows. Lots of good reading material on this subject now.
  2. Goto:  msysgit.
  3. Download and install msysgit. Note: if you use GitHub for Windows, you can skip this step as Git is installed for you.
  4. Leave all settings the same except: uncheck git-cheetah and select Git Bash Here and Git GUI here instead.
  5. You might prefer git-cheetah or git-extensions, but they are basically clones of gitk and git-gui which you will already have. They just add shell extensions, which msysgit also already has: git-bash (a bash console) and git-gui. TortoiseGit and GitHub for Windows will also add shell extensions.
  6. This part is really irrelevant. GitHub says it will not work with plink/putty ssh keys, which is the default in TortoiseGit, but I’ve seen numerous posts that say it does, maybe the docs are out of date. Also TortoiseGit will give you the option to use Git's SSH client, but claim Putty/Plink works better on Windows. Also since all 3 Tortoise projects share libraries, chances are if you have TortoiseSVN or TortoiseHg you already have Plink.

Git Clients TortoiseGit

In addition to TortoiseGit there is also Github for Windows and Atlassian's SourceTree. There are even more Git clients listed on the Git websiteFor now I would still recommend against GitHub for Windows, as it is helplessly stoopid. For TortoiseSVN users - I would recommend sticking with TortoiseGit. Either way you will find with Git, the command line is somehow irresistible.
  1. Install TortoiseGit. Look at the downloads and grab the latest version for your machine, either x64 or x86.
  2. Stick with Plink/Putty; and let’s see if it just works.
  3. You may need to restart, or you may not. Restart, yay! It works (and even better than tortoiseHg, I might just uninstall that since it only works best on Windows - there's a problem with the windows api’s that cause the sub-context menu items to appear off the left edge of the menu - I'm going to take a look into that.)

PuttyGen

  1. GitHub only uses ssh and https (Bitbucket also uses ssh and https), so you only need to do this for GitHub or if you want to use ssh, which is cooler so why wouldn't you.
  2. Do you already have a key pair generated? Look for a .ssh folder.
  3. Create a key: programsàtortoiseGitàputtyGenàgenerate
  4. make sure that you do not already have %userprofile%.ssh folder, click show hidden files in folder options, or in cmd shell use dir .* to list all dot folders.
  5. Save keys in %userprofile%\.ssh (you need to make this directory in cmd shell, mkdir .ssh
  6. Copy the text in the window of your public key and paste in a file, this is what you will paste into GitHub or Bitbucket.

Shell

Have a look at Console2 by bozho - it's my favorite! Also set up Meld as your diff/merge tool, beyond sweet!

Success!

More links on ssh/putty

  1. Just the last part: Bitbucket Documentation: Set up SSH for Mercurial
  2. Didn’t read this: TGit wiki: UsingPuTTY

No comments:

Post a Comment

Fork me on GitHub