Configuring GitHub on Windows

If you’re a Windows developer like me, you’ve probably had trouble working with GitHub on Windows. Here’s what I did. Hopefully this will be helpful to you.

Getting Started

First you need to grab a copy of Git for Windows. Once you’ve downloaded the latest version, launch it and go through the license and location screens. Once you get to the “Select Components” screen, make sure both Context menu entries are selected. If you want, select the TrueType font option. That one shouldn’t really matter.

Jump ahead a few more frames and you’ll get to the SSH executable option. Choose “OpenSSH”, unless you have a compelling reason to use Plink.

Run through the rest of the frames, accepting the defaults. You now have Git installed on your machine, but we’re not quite done yet. GitHub uses public/private key encryption. This means you don’t commit with a username and password, like most SVN setups. Instead, you tell GitHub your public key, then use your private key to authenticate.

Generating a Public Key

GitHub has a detailed article on setting up your SSH keys on Mac/Windows/Linux. I recommend checking it out.

Clone a Repository From GitHub

You’re just about there. Go to your GitHub repository and select and copy the text in the textbox near the top of the page. Make sure SSH is selected.

Open up Git Bash. You should be able to find it in your start menu. “cd” to the directory where you plan on checking out your code. For example, if you want your code to be located in C:\programming\project then you want to “cd” to C:\programming.

Type out “git clone ”, but don’t hit enter yet. Go to the top left corner of the Git Bash window and click. In the menu that pops up, select Edit –> Paste to paste the URL of your repository, but still don’t hit enter. Finally, type the name you want to call the project folder. In our example, you’d want something like this:

git clone project

Now you can hit enter :)

If you entered a passphrase for your private key, it will ask you for it. If all goes well, your repository should be downloaded.

Some Sample Commands

This isn’t really a tutorial on Git commands, but here are a few to get you started:

# See what files have changed:
git status

# Add a file (new or modified, it doesn't matter. You need to add it to commit it)
git add file.php

# Add several files:
git add *.php

# Commit your changes locally (just stores a local snapshot of your changes):  
git commit -m "Your commit message here"

# Push your changes up to GitHub:
git push -u origin master

# Pull down updates from GitHub:
git pull

That’s about it. There’s more to Git (which I’m still learning about), but this should hopefully be enough to help you get started.

I am now accepting new clients for part-time consulting and software development projects. Learn more

I haven't configured comments for this blog, but if you want to get in touch, you can find me on Twitter