Setting up msysGit

Blog Topics:

Setting up msysGit on my Win7 box has been a bit of a pain.

Here's a step by step guide:

1. I don't quite understand what the Portable version is all about, but I went with the other one.

2. If you're not running as Administrator, then the Installer fails. So, run it as Admin. I had also installed TortoiseGit, and the Installer made me choose from
( ) Use OpenSSH
( ) Use (Tortoise)Plink
The former ultimately lead to success.

3. The downside of installing as Admin is that the Installer will define a global environment variable called "HOME" that points to "c/Users/Admin". Obviously, C:\Users\Admin is not accessible to any user but Admin, and this will cause problems. Fix it by setting "HOME" to "%USERPROFILE%" (without the quotes but with the percent signs).

4. Next move was to try to set up keyed SSH authentication. Originally I tried to do this with TortoiseGit's puttygen, which by default produces the wrong type of key. Then I tried msysgit's ssh-keygen. This worked better, but the remote host kept on telling me

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 65:83:8e:7d:ef:3c:aa:2c:fd:0d:15:42:d6:45:47:e4
Connection abandoned.
fatal: The remote end hung up unexpectedly

It turned out that the Installer had put another variable into my global environment: GIT_SSH='c:\utils\plink.exe'. That plink.exe is part of PuTTY, which has its place on my computer, and somehow the Installer decided to use it, but it would not work. Simply removing the "GIT_SSH" environment variable fixed that one and finally got me going.

The rest is personal customization: I like using the editor in File Commander for Windows for small editing jobs:

5. To get msysGit to use FCW, I set the "GIT_EDITOR" global environment variable to "/c/utils/fcw -e '$*'" (again without the double-quotes). There are other ways to do this, but this worked fine.

6. In addition, I added the following small files to C:\Users\HS\bin:

edit
#!/bin/sh
/c/utils/fcw -e $@

fcw
#!/bin/sh
/c/utils/fcw $@

mktemp
#!/bin/sh
/c/utils/mktemp $@