Installing “PortableGit from msysgit” on Windows 7

I wanted to install Aptana Studio 3 onto my Windows 7 machine at work, and according to Aptana’s Getting Started Guide, I needed to have Git installed.  According to the Aptana website, the Aptana Studio installer should install “PortableGit from msysgit” for me if I want, but that didn’t seem to happen.  So, I did a little searching for some instructions on installing PortableGit, but when I couldn’t really find anything helpful, I came up with a set of instructions on my own.

PortableGit is an implementation of the Git version control system for Windows machines.  It uses the very handy MSYS system to provide a Bourne Shell (bash) command line interpreter system. There’s at least a couple different versions of Git for Windows available from these msysgit guys; I like the PortableGit version because it doesn’t mess with my registry, it doesn’t install anything in my Start menu, and if I want to delete it, I only need to delete the files, not run an uninstall program.  It’s very self-contained, and I don’t have to worry about it mucking about with my computer. This isn’t the most user-friendly version, but if you’re an old command-line hack like myself, it’s fine.  And, for what I’m going to be using it for (letting Aptana Studio use it!), it’s all right.

I grabbed PortableGit from http://code.google.com/p/msysgit/downloads/list (see image below — click the image to see a readable full-size screenshot!).

Listing of all of the Git for Windows files available

I selected the file called PortableGit-1.7.11-preview20120710.7z.  This was the latest version at the time I downloaded it; of course, if you’re reading this anytime after the day I post it, there may be a newer version!  Clicking on that link takes you to this page (again, click the image to see the full-size screenshot):

I clicked on the little arrow on the left side of the filename, and it downloaded the file for me.

Although this is an executable installer, the file can’t be executed as-is – the file extension needs to be renamed from .7z to .exe.  Once I did that, I was able to run it.

Note that, depending on your Windows setup, you may need to run the installer as an administrator.  For me, I had to find the file in Windows Explorer (I saved it to my Downloads library), then right-click on the file, and select “Run as administrator”.  When I did that, I was greeted with the following dialog box:

That location was exactly where I wanted to install it, so I left it at that.  Click OK, and the program is installed.  If you get an “access denied” error, it means that you need administrator permission AND you didn’t run it as an administrator, so try again.

Once you’ve got the program installed, if you want to learn more about the “Portable” aspect of PortableGit, navigate to the C:\Program Files (x86)\Git folder.  There’s a README.portable file that explains everything.

Once we’ve got PortableGit installed, we’re going to want to be able to run it.  The program we’ll be running is called git-bash.bat, and that will give you a Bash shell that you can run Git commands in.  To be able to run that program, we’ll need to add Git to my list of executable folders (my “path”) so that I can run it from the command prompt.  To do so, do the following.  Open the Start menu, then right-click on Computer:

From the pop-up menu that comes up, select Properties.

You’ll get a window that is titled “View basic information about your computer”.  On the left-hand side of the window, there’s a menu titled “Control Panel Home”; select “Advanced system settings”.

You’ll get a System Properties window.  Select the Advanced tab, and then click the Environment Variables… button:

You will get a list of all the environment variables in the system, similar to this:

Right now, I have no Path user variable, but I do have a Path system variable (if I had been smart, I would have scrolled down to show it in my screenshot!).  The Path variable tells Windows which folders contain programs to execute from the command prompt or the “Search programs and files” box on the Start menu.

You now have a choice: if you want to add Git to the path for all users, you’ll want to add Git’s folder in the Path environment variable in the “System variables” section (and you’ll need to be an Administrator to do it); if you only want to add it for yourself, you’ll need to add it to (or create) the Path environment variable in the “User variables” section.  I’ll just add it for myself.  If you have a Path variable, select the Path variable and then click the Edit… button; if you don’t have one (which I didn’t), just click the New… button.

If you’re adding to an existing variable, you’ll get a window that is similar to this:

To the end of the existing value, type a semi-colon (“;”) followed by the complete path to the folder that you installed git in (in my case, C:\Program Files (x86)\Git).  The semi-colon is used to separate all the folders on your path.

If you’re creating a new variable, you’ll get an almost identical window that looks like this:

For the Variable name, type in Path.  For the Variable value, type in the complete path to the folder that you installed git in (in my case, C:\Program Files (x86)\Git):

Press OK, and you should be good!  You can now finish up by pressing OK on the Environment Variables window, OK on the System Properties window, and then close the “View basic information about your computer” window.

Next, let’s make sure it’s installed.  We’ll want to run the git-bash.bat file from the command line.  Click on the Start menu, then in the “Search programs and files” box in the bottom left corner, type git-bash and press the Enter key:

Your Start menu will go blank, and there will be a “Searching” message displayed, but soon you’ll see the git-bash command prompt:

If you see that, you’ve successfully installed PortableGit!

If you want to learn HOW to use git, I recommend the Git site: http://git-scm.com/.  I’d especially read the Pro Git book on that site.

One thought on “Installing “PortableGit from msysgit” on Windows 7”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.