Git - A Hater's Guide

Let's get something straight: I hate git. Don't get me wrong, it's one of the best SCMs out there. But c'mon, let's be honest: That's not a very high hurdle to clear.

If you use Linux everywhere, git is a breeze. But if you're not a command line loving, booger picking freak, it's a real pain. So, I figured I'd record some of my findings here in the hopes of saving others from the same drudgery. (Also, if I don't write this down, I'm sure I'll forget all about it within three months.)

Here are a list of gripes and how I rose above them:

Complaint #1: Windows Installation

Yes, I still use Windows 7. I'm not cool and I don't care. I've never been cool, and I don't want to start being cool now. Also, I hate turtlenecks - in any color.

The installation on Windows isn't really that bad. However, when it comes to setting up environment variables, the install practically dares you to take "safe" options. If you do this, then git won't be able to find the binaries it needs to sync with a remote server. This of course begs the question: Why didn't you tell me git would be inoperable w/o the more "daring" settings?

If this happens to you, simply add the git binaries to the path. I installed git in c:\apps\git, so I added c:\apps\git\libexec\git-core to the path.

Maybe someone can tell me why git has two bin directories. Maybe not.

Oh, by the way: You may also need to copy two DLLs over into the git-core directory
copy c:\apps\git\bin\libiconv2.dll c:\apps\git\libexec\git-core\
copy c:\apps\git\bin\libiconv-2.dll c:\apps\git\libexec\git-core\

Here's how you know this pathing issue is fixed on your client:
Type 'git-upload-pack' at a command prompt. If it shows you what parameters to type in, then it's in the path. If you see DLL errors, or the .exe can't be found, re-read this section.

Complaint #2: Installing Git on a Mac

You think this would be simple, because - at it's base - OSX is Unix-ish. Unfortunately, it gets inexplicably installed into a directory that's not in the path. (Something stupid like "/usr/local/git/bin/". Don't ask.) This creates all kinds of headaches when using ssh, because ssh can't find the binaries it needs. Even worse, ssh no longer looks at environment variables in .bashrc. So, you end up having to tell the local repository where to find the git binaries on the server. (Lovely, eh?)

To push stuff to the server, Linux folk use this:
>git push mymac master

For me, I had to specify the location of the executable, by doing this:
>git push --receive-pack='/usr/local/git/bin/git-receive-pack' myuserid@mymac:repos/code.git master

You should be able to put this in the git config file:
[remote "mymac"]
url = ssh://myuserid@mymac:repos/code.git
fetch = +refs/heads/*:refs/remotes/mac/*
uploadpack = /usr/local/git/bin/git-upload-pack
receivepack = /usr/local/git/bin/git-receive-pack

Unfortunately, I'm still having ssh issues, so I'm sticking with the long, boring version (for now).

Absolutely lovely.

Complaint #3: scp

When creating a new remote repository, you're supposed to clone a local repository, and then copy it to the server using scp. Unfortunately, if you type this from Windows (Cygwin):
scp -r repos.git myuser@mymac:~/git

You end up with a directory on your mac that has the following permissions:

d---------- myuser staff 340 Dec 7 repos.git

Which means that absolutely no one can do anything with this repository. Perfect!

It's probably obvious to you by now, but you need to run a booger picking 'chmod' on this directory so that it's actually usable:

chmod -R 755 repos.git

Complaint #4: EGit and Eclipse

Although it's not the fastest IDE on the planet, you can usually count on Eclipse for making things simple. Unfortunately, that's not really the case with EGit.

I'm sure there's some elegant way to start off with everything in Eclipse / EGit, but that didn't work for me. Here's what I had to do:

  1. Start off by installing Git (for Windows) first.
  2. Install EGit, and "tell" it about the git installation you just did.
  3. Use native git (the booger-pickin' command line) to create a new git repository
  4. Use the command line to add projects to your local repository
  5. Use the command line to 'push' stuff to the remote server.
  6. From within EGit, add a local repository. (The one you created in #3.)
  7. Go back to your Java (or whatever) perspective, and import the project. (Import->Git->etc...)
  8. At this point, it seems as if you can use EGit and commit changes to the local repository pretty easily.
  9. When you want to push changes to the server, go back to the command line. Avoid the new found urge to pick your nose.

Well, that's it for now. I'm sure I'll be updating this over time, but these first few steps were real killers. Enjoy!