How to Install and Get Started with Git for Windows

This tutorial is an introduction to installing and using Git on a PC running Windows 7. I set up a XAMPP server using XAMPP 1.6.8. I have not installed Putty. I also have not installed TortoiseSVN or TortoiseGIT. The last time I tried to install Git for Windows with TortoiseGIT, things got all mixed up and I could not connect to my repository on There was a problem with the SSH keys and I kept getting an authentication error. 

My plan is to create a free public Git repository on and upload my Drupal 7 site to it. It will be a single user blog with photo gallery that is freely available for download.

I followed these instructions exactly on a fresh install of XAMPP free of TortoiseGit and TortoiseSVN. Be sure to follow these instructions exactly as directed.
NOTE: DO NOT use Putty if you are given the option. GitHub only provides support for OpenSSH.
A. 1. Download Git for Windows here:
2. Follow the instructions here exactly as it says.
3. Be sure to select these options:
- Use Git Bash only
- Checkout Windows-style, commit Unix-style line endings
B. Set up SSH keys
  • SSH keys are used to establish a secure connection between your compuer and GitHub. Be sure to follow the steps.
1. Open Git Bash from your Windows Start menu. Git Bash is a command line interface that comes with Git for Windows.  I’m going to assume that you don’t have any keys.
2. Generate a new SSH key:
To generate a new SSH key, enter the code below into Git Bash. We want to use the default settings, so when you are asked to enter a filename in which to save the key, just press enter.
$ ssh-keygen –t rsa –C
Generating … message
Now you need to enter a passphrase:
3. Add your SSH key to GitHub
Open your file in a text editor. Copy and paste the key exactly as written without adding any new lines or whitespace. You can use a text editor called VIM. See this post:
vim c:/Katy/Users/.ssh/
To access your account at Git Hub. Let’s test everything out.
$ ssh –T
C. To create your own repository:
1. Open Git Bash from Windows Start Menu
2. Navigate to ~/ssh
$ ~/ssh
3. Show the directory contents
$ ls –lah
4. Make a new directory
$ mkdir swd-drupal77
5. Change to your new directory
$ cd swd-drupal77
6. Initialize your directory to become a git repo using “git init”
$ git init
7. Create empty README file
$ touch README
8. Open README in text editor and add some text
9.  Add README file to your staging area
$ git add README
10. Commit your file to your local repo or working directory
$ git commit –m ‘adding readme’
This code executes actions locally. This means you still haven’t done anything on GitHub yet. To connect your local repository to your GitHub account, you will need to set a remote for your repo and push your commits to it:
Follow these directions to create your public repo on
If you are commiting to your github account for the first time, use this command:
$ git remote add origin
If you are updating a file on your existing github repo, then use this line:
$ git push origin master
You can check your repo on and see your updated file.
At any time you can check the status of your repo.
$ git status
Make a change to your file, README
Add to staging area
$ git add README
Commit to local repo
$ git commit –m README ‘add comment here’  # -m allows you to add a comment
To upload the changes to your repo on github, use this line
$ git push origin master
And enter your passphrase
Add all the Drupal site files by dragging and dropping into the working directory
Use this command to add all the site files to the git repo
$ git add .
This adds all files in the current directory recursively, meaning all files in the subdirectories.
$ git commit –m ‘upload all Drupal 7.7 files’
This addes all the site files to the staging area
$ git push origin master
Enter passphrase
This will upload all the site Drupal files to the git repo on

This tutorial ended up being longer than I planned. But it gives you an overview of the basic commands you need to use to upload your Drupal site to your free public repository on Feel free to leave your comments and questions below:


Good article

Really nice information. Affordable Web Development Services


Thanks, you're post helped me a lot, very useful. 

Good Graphic Design

This looks good with graphic web design, you can also get more ideas on Minneapolis Web Design.

web studio

I am really impressed in your blog…..and Thank you for sharing this information…It is Very interesting..Professional web designers San Francisco

Nice Post

Great, thanks for sharing this post. Cool.