Git on Windows

Last updated by Adam West on June 03, 2015 16:32

Getting Git ready to use on Linux or OS X is simple. This guide is about setting up GIT and SSH on Windows, it's a bit more time consuming to do than the other two operating systems, but once it's up and running you can use it in the same way.

Installing Git

If you haven't already done so, you need to start by downloading the latest version (it should be labelled as 'full installer') of msysgit, a free git installer for Windows.

If you're not too sure what you're doing, then it's best to simply click through the first few screens leaving all the options as they are. When prompted about PATH options though, we advise selecting "Run Git from the Windows Command Prompt" - that way you can use Git on Windows just as you would if you were using Linux or OS X.

Once you've done that and clicked "Next", you will be greeted with another page asking how to configure line ending conversions. If you're planning on sharing this project with people using different operating systems, then "Checkout Windows-style, commit Unix-style line endings" is the way to go, otherwise it's up to you what you select. If you're unsure, leaving the default should be fine.

All you have to do now is click "Next" and follow any instructions it gives to install Git onto your computer.

Setting up SSH Keys

Before you can start pushing to Codebase, you have to generate and give Codebase your SSH key.

To do this, open Git Bash from the start menu.

Once you've done that, a Command Prompt window will open with a prompt that looks something like this:

# Welcome to Git (version # # Run 'git help git' to display the help index. #    # Dan Wentworth@WIN ~ # $
Type in this command and hit enter (make sure to replace with your email address):
ssh-keygen -C "" -t rsa

It will then ask you about where to save the generated keys and if you want to use a passphrase to protect them. If you're not sure, then just hit enter three times and it will save to the default location without a passphrase.

Once it has generated your SSH Key, browse to the location that you saved it in (if you didn't change it, then it will be in C:/Users/YourUserName/.ssh) and open the file with Notepad.

Now all you have to do is follow the instructions in Getting Started to put your key into Codebase.

Using Git

Now it's installed, Git will work the same way as it does on Linux or OS X. All you have to do is load Command Prompt (Load the Start menu, then click "Run", type cmd and hit enter), then you can use Git commands as normal.