Setup Git and GitHub for Windows 7 for use with Bitbucket

Posted on

Git is an excellent tool for programmers, one which I have yet to see the full potential of. Recently, I needed to get familiar with it for my job and a coworker suggested a few applications to use. All but one of the programs were for Macs (a problem, since I’m a PC user), and the only other program, GitHub for Windows, wasn’t exactly optimized for easy use with bitbucket. So I just stuck with Git for Windows, the command line Git Bash.

After a few weeks, I needed to bring some fellow PC using coworkers up to speed with git and bitbucket. So I finally made an effort to figure out how to get GitHub for Windows working with bitbucket. Since everything I needed to know was scattered across the web, I decided to consolidate all that information in one place for my coworkers to use.

Important Update!!!

The people behind BitBucket, Atlassian, are running a beta for their windows git client: SourceTree for Windows. View my quick post about it.


This guide will help you setup GitHub for Windows to use bitbucket repositories on Windows 7 (and I suppose Vista too), and go over basic usage of GitHub for Windows. This guide combines information found on Atlassian’s guide to Git and bitbucket and Steve Bumbaugh’s Guide: “GitHub for Windows Client: For bitbucket”, and also experience I’ve gained from using Git, bitbucket, and GitHub for Windows.

I’ve successfully tested this process a few times now, but things tend to go wrong. So if you have any issues, add a comment and I will try to help you out. Also, if you had a problem and found the solution, add a comment describing what you did so I can add it to the guide.

Credit where Credit is Due

Steps 1 and 2 includes information consolidated from Atlassian’s guide to Git and bitbucket.
Step 3 includes information gathered from Steve Bumbaugh’s Guide: “GitHub for Windows Client: For bitbucket”
Special thanks to Russ Offord for testing this guide and helping me iron it out!

The Steps and The Skills

Step 1 – Install Git: Basic computer skills
Step 2 – Setup SSH with bitbucket: Basic computer skills
Step 3 – Install GitHub for Windows: Basic computer skills
Step 4 – Clone a Repository from Bitbucket: Basic Git learned from previous steps
Step 5 – Manage the Repository with GitHub for Windows: Basic computer skills
Step 6 – Commit Changes with GitHub for Windows: Basic computer skills


Before getting started, you will need the following:

  1. A bitbucket account – I like them because they allow you to host private repositories on free accounts.
  2. A GitHub account – They don’t allow for private repositories on free accounts, but an account is needed for their software.

Step 1 – Install Git

  1. Download the latest version of Git for Windows (Right now they are all beta, that’s ok though!) and install it. It’s a straight forward process, so I won’t drone on about it. Just keep hitting “Next” and leave all of the defaults selected.
  2. Then, start Git Bash (Start –> All Programs –> Git –> Git Bash)
    First Start of Git on Windows
  3. According to atlassian, you should run these two commands in Git Bash. NOTE: Use the information you used with bitbucket for the values in quotes below.
    git config --global "FIRST_NAME LAST_NAME"
    git config --global ""

Step 2 – Setup SSH Key with bitbucket

  1. Check if ssh is set up on your machine
    ssh -v

    This is what I see:
    SSH is installed
    If you don’t see something similar, go to the link I provided above, to Atlassian’s guide, in order to get SSH working right on your computer.

  2. Now it’s time to create what is called a “Default Identity”
  3. You will be prompted to type a filename for where you want the ssh key to be saved. Just hit Enter
  4. You will then be asked for a passphrase. This may seem counterintuitive, but just press Enter. At the time of this writing (07/13/2012), this is necessary to be able to use GitHub for Windows with bitbucket repositories
  5. Press Enter again to confirm the lack of a passphrase

    The SSH Keygen Process

    Somehow my empty passwords didn’t match the first time O_o

  6. The next thing we have to do is set up a config file. So go into your User directory (Start -> UserName) and open the folder called .ssh. Create a new text file here, call it config (no file extension), open it in your favorite text editor and type the following. NOTE: Replace “faison” with your bitbucket username. Also, the “tabs” are necessary.
    User faison
    IdentityFile ~/.ssh/id_rsa

    If you can’t make the file without an extension, just call it config.txt. After entering the information above, open Git Bash in the .ssh folder (right-click -> Git bash) and enter the following command:

    mv config.txt config

    That command will rename config.txt as config

  7. After saving that file, go back into the .ssh folder and open in your text editor. Select all the text and copy it (Ctrl + A, Ctrl + C)
  8. Log in to bitbucket and go to your account settings (Hover over your Username in the nav menu, then click “Account”). On the following page, click SSH keys. Here’s the page:
    bitbucket's SSH keys section
  9. In the Add a new key form, enter something like “Default key for computer-I’m-on” for the Label, and paste the contents from into the SSH Key field. Press Add keyand hope it works. NOTE: You will have to do this for every computer you want to use this on, eventually.

    SSH added to bitbucket

    It Worked!

Step 3 – Install GitHub for Windows

  1. Download GitHub for Windows
  2. Install it, from what I could tell there is no customization during installation. When it’s done, GitHub for Windows will start automatically
    GitHub for Windows
  3. Press Log In and enter your GitHub credentials. Then enter your name and email into the Configure Git section and press Continue. If you end up in the Repositories section, just skip.
  4. Now back in the .ssh directory from Step 2, open the newly created file,, in a text editor. Delete everything in this file, and paste the contents of into it.
  5. Now log into the GitHub Website. Click the Account Settings icon
    GitHub Settings Icon
    Click SSH Keys, then click the Add SSH key button.
  6. This is pretty much the same thing as before. Type something like “Default key for computer-I’m-on” for the Title and paste the contents from into the Key field. Press the Add key button to finish up.

Step 4 – Clone a Repository from Bitbucket

  1. Log in to bitbucket and go to the test repository I set up for this guide.
  2. Press the fork link

    The Fork Button

    Just so you know where it is.

  3. You are then presented with a form that allows you to choose the The then press the Fork repository button. This should bring you to the page for your newly forked repo.
  4. Now on your computer, open up a directory that you want to store your repository in. For this, I went with C:repos. Open the folder, Right-click in it, and choose Git Bash. NOTE: I didn’t get this option in the Documents directory.
    Git Bash in Explorer
    This will start Git Bash in the current folder and eliminate the need to use command line commands to get to the right directory.
  5. Type the clone command (into Git Bash) that is found on the new repository page that you created on bitbucket, and hit enter.

    Bitbucket Clone Command

    Type everything after the ‘$’

  6. I was prompted: “The authenticity of host ‘ (’ can’t be established.” Just type yes and hit enter to continue the cloning. This should only happen the first time you clone a bitbucket repository on a computer.

    First Clone with Git

    Yeah, this screenshot is me cloning a different repo, what’s it to ya?

  7. After the Cloning succeeds, you will have a new folder with the same name of the repository.

Step 5 – Manage the Repository with GitHub for Windows

  1. Drag the folder that contains your newly cloned repository, onto GitHub for Windows
    Dragging the Repository
    Here’s how it should look after you drop the repository:

    After Dropping the Repository

    Now it’s in GitHub for Windows!

Step 6 – Commit Changes with GitHub for Windows

  1. Now let’s add a new file into the repository folder, just to make sure everything is working right
    File added to repository folder
  2. In GitHub for windows list of repositories, double-click the newly added repository. You should see a prompt regarding uncommitted changes
  3. Type in a commit message that reflects your changes and press the Commit button.
    GitHub for Window's Commit Prompt
  4. The in sync text will now turn blue and change to say sync, indicating that you should sync it with the bitbucket repository. You can wait to bank a few commits, but we’re going to sync right away. Click sync.
    Sync the commits

    Click the blue text

    Commits are syncing

    Now you wait

    Commits are synced

    And it’s done!


So that is how you setup GitHub for Windows to use bitbucket repositories, and the basic way to use GitHub for Windows. If you want to setup multiple computers with GitHub for Windows, follow the complete guide. If you want to grab another repository to manage with GitHub for Windows, all you have to do is Clone the repository from bitbucket, Drag and Drop it into GitHub for Windows, do some work, and commit.

This is still something that I’m decently new with and I’ve only used this setup with one person working on a repository at a time, so comments on how well this works in a multi-user setting would be greatly appreciated. In fact, all real feedback and comments would definitely go a long way in helping me to refine this guide, to fix any missteps in my usage, and to improve my ability to write in general.

Thanks again, everyone!

Tags: , , ,

  • Russ Offord

    Awesome, I followed your guide word for word and got up in running from 0 to 60 in no time at all! This step by step procedure should be called “GitHub on Windows with BitBucket for Dummies.” 😀



  • Eric

    This is exactly what I wanted. Thank you for this great tutorial


  • Victor Vilche

    This is awesome!

    Just in time 😀



  • Precious

    Thanks a lot for this tutorial I found it very hefplul.I only used it as a last resort as I didn’t find anything else provided by svn (except dump and load, which is a ridiculous solution cause I should not have access to svn machine to be able to create multiple commits with different revisions).anyway When I followed the steps you providedafter I entered the command:git rebase git-svnI got errors like the following one:CONFLICT (delete/modify): deleted in HEAD and modified in template and template instance creation implemented. Version template and template instance creation implemented of left in tree.And what that basically means is that there are some files that are not available on local git so whenever I got that I entered the following command till all was complete:git add -Agit rebase continueafter the last command completed successfully I completed as described in the tutorial.


  • Chris Dean

    Wonderful page, Thanks for your time


  • fullparam

    I got success, after realizing that the clone command needs to be executed not within the root folder of the future Repository.
    I.e the current dir of command prompt should be on C:Source. The clone command was able to create the directory itself.
    So the final structure was afterwards.
    >> Source
    >>>> RepoName
    >>>>>> .git


  • Alberto Toquero

    Thanks for you tutorial, it’s very useful. In my case I’ve found a difference I ‘ve created the file: but it works in any case


  • Dmitriy

    After all steps a may tracking repo in Git For Windows, sync it on Bitbucket, but if I have change and press commit Git show me error: “Error on commit. Open Shell.” If I commit via TortoiseGit its commited without problem. May you help me with problem?


  • Yasen Vasilev

    That sounds great. I’ll try it now.

    PS. I resized my screen to avoid the annoying green color.


  • Yasen Vasilev

    Works perfectly. It’s great, because I prefer BitBucket better than GitHub, but it didn’t have any software as GitHub.


  • Brian Stewart

    Great step by step, I didn’t miss a beat in setting this up. I’m new to both bitbucket and github and need to use both to manage multiple repositories. This will help a lot with integration! Thanks.


  • Brian Stewart

    I do have a question. How easy is it to go the other way. I’ve got a repository I pulled down from gitHub that I want to check in as a repository in bitbucket. Basically I want to reverse the flow that you have described in your example here. I could do it on the command line I suppose, but I’m really a GUI guy if given the choice.


  • Dhana

    To get the popup with git base ( for the below issue )

    “Now on your computer, open up a directory that you want to store your repository in. For this, I went with C:repos. Open the folder, Right-click in it, and choose Git Bash. NOTE: I didn’t get this option in the Documents directory.”

    please choose the directory and right click( instead of right clicking it from inside the directory), it will work. You can see it git base /C/Users/YOUR_USER_NAME/Documents/BitBucket/YOUR_REPO_NAME (master)


  • Amol

    thanx man … you are great !!!!!!!!!!!!!!!!!!!!!!!!


  • Carlos vivas

    Thanks a lot dude! just what I needed and perfectly explained. When i have more time will try to learn to do it via the console, but this was just so easy to do thanks to you!


  • Bongo

    Dude!!!! this is awesome thanks man


  • Boshy

    Dude! The most awesome Git tutorial ever! Thanks so much, like really! I use Git on Mac and PC and this is by far the best way of using Git, using Github and using Bitbucket. To quote Chris Coyier, I totally Suck at Git, and now I suck less. A lot less. You really are the man.


  • J

    Does anyone had issues with cloning repos : “no address associated with name” ?


Leave a Reply

Your email address will not be published. Required fields are marked *