Github for Windows connected to Bitbucket

Git on it’s own can be a little intimidating to learn. Github is a place to host your Git repositories. Github offers some nice features to manage your repositories and make it easy for people to find your open source projects. But to do much real work on a Github project you still need Git on your machine plus your own local repositories. You can use the git bash command line on Windows just like on other operating systems. But to most developers used to graphical interfaces, it is a big leap to make.

Some hardcode git users trivialize graphical interfaces; saying that any real developer should just learn to use the git console. I think that is a lame argument. If that was a valid point, then we’d all stop using our fancy high level programming languages like C#, Java and even C++ and plain C. We’d all just develop everything in Assembly language.

Enter Github for Windows

Github for Windows makes using Git as simple as every other source control interface. Github projects also have a button “Clone in Windows” which creates a local repository of the project on your machine. Github has some great documentation to get started on their help page.

Bitbucket repository hosting compared to Github

Competition always helps drive a market to serve customers better. There are many Git repository providers. Bitbucket is one git repository hosting company; It works very similar to Github. Both are great repository hosting options, each with competitive benefits over the other. For public open source Github is the defacto standard.

For private project repositories the best choice depends on your plans. If you plan on small teams and want to segment projects into a series of small respositories then the best deal seems to be with bitbucket. If you have a large team and only need a few repositories, then github seems to have the best deal. You can start with unlimited free private repositories on bitbucket that are limited to 5 contributors. Adding contributors on bitbucket adds cost. Github charges per repository, but each comes with unlimited contributors. Both options are cheap for the entry level packages.

You may also want to choose your host of choice based on other features such as wiki pages, issue tracking, or automated commit deployment to your cloud hosting provider. You’ll have to research which host meets your needs the best.

Integrating Github For Windows with Bitbucket

Github for Windows is easy to integrate with other git hosting providers. Bitbucket makes it easy because it gives you the one and only git command line you will need to type in during setup. First create an account or login to Bitbucket.

Bitbucket Site – Create the remote repository

You can create a repository from the ‘Repositories’ dropdown at the top of the page; or use the keyboard shortcut, ‘c’ then ‘r’. Fill out the create repository form; see the screenshot as an example.


After creating the repository you will see a getting started wizard, with the first step as “Add some code”.


On this page click on the link “I’m starting from scratch”. You will then see the git commands you need to type on your machine to get your local repository setup.


Create your local repository

Now that the remote bitbucket repository is created, you need to create a local repository on your computer and connect them. First make sure you have ‘Github for Windows’ installed. It installs all the git prerequisites for you as part of it’s install, including the first tool you need to open, “Git Shell’. This is a powershell windows loaded up with Git support.

In the git shell type in the commands given on bitbucket.


Copyright (C) 2012 Microsoft Corporation. All rights reserved.

C:\Users\micha_000\Documents\GitHub> cd C:\users\micha_000\Documents\Bitbucket\candor-sample
C:\users\micha_000\Documents\Bitbucket\candor-sample> git init
Initialized empty Git repository in C:/users/micha_000/Documents/Bitbucket/candor-sample/.git/
C:\users\micha_000\Documents\Bitbucket\candor-sample [master]> git remote add origin
C:\users\micha_000\Documents\Bitbucket\candor-sample [master]>

Update Feb 28, 2013: You can now drag and drop a url to clone a repository from Bitbucket or any other url based Git repository into your Github for Windows client. For details, see the official notice from Github released on Feb 21, 2013.

Now your local git repository is created and linked to your bitbucket remote repository. The next step is to make ‘Github for windows’ recognize the project. Open ‘Github for Windows’. Make sure you are in the repository list and not viewing a specific repository. From this main window you can drag a folder from windows explorer and drop it on the repository list. You don’t want to use the “Add” button because that is for creating a new repository, and only on “”


Now the repository is in the list. Click on the repository to see the readme to the right. Assuming you did not add a readme yet, you will see a message that it has no readme file yet. Click on the arrow to the right of the respository to open the repository. The first thing you will see is a prompt to login to the remote repository. Enter your credentials on bitbucket to continue.


After logging in, you will see the status of synchronization between your local and remote repositories. They should be identical at this point.


Making and Committing a readme

Now you have a connected local and remote repository. The next step is to create a local readme file and sync it back to bitbucket.

Before commiting to bitbucket, on the bitbucket site it will tell you the next step is make some changes and push. You can ignore the git commands in this step since we are using ‘github for windows’.


Do not open Git Shell and enter the commands above unless you like the torture of the command line. Instead from the comfort of windows explorer, create a readme file with either .txt or .markdown extension and add some content to the file. Then switch over to Github for Windows and open your repository if it is not already open. You will see that it recognizes that you added a readme file. To the right a commit form is waiting for input. Enter a comment and press the ‘commit’ button.


This does not send the changes to bitbucket. This only committed to your local repository. Remember since this is a DVCS you have a full revision history of commits locally also. Any commit only affects your local repository. This is a good thing since it lets you commit as much as you want locally during development, even before you have a working version of code; without it affecting anyone else that may be on your team getting latest from the remote repository. To send your changes to the remote repository, press the ‘publish’ button on the top of the repository view.


Now if you switch back over to the bitbucket site you will see your committed changes. I have seen Github for Windows fail to publish after leaving a bitbucket repository open for hours at a time. The UI also reflects that no publish occured, but it does not give an error message as to why. I suspect the bitbucket authenticated session ended. This was easy to fix by going back out to the repository list and then back into the repository. It then prompted me for my bitbucket credentials again. Then the publish command worked.

Adding gitignore, gitattributes

At some point you will presumably add a code project to this repository. Most languages have some user specific files or compiled output that you do not want to commit to your repository. You can specify these files in the gitignore file. You could add this file manually, but Github for Windows has a default one that covers most programming languages already. When you are in the repository view, press the ‘tools’ button which is up by the publish button. Then select menu item “Settings…”


In this window you see the remote repository details, and a button to add an ignore file and an attributes file. It is recommended that you add both files. After pressing the buttons to do so, the files appear in windows explorer and a preview of them appears in this settings window. You can edit them here, or open them in your preferred text editor. Note, press ‘Update’ before the files are added to disk.

I normally stick to the defaul contents of gitignore, but I have found the need to make some minor changes during setup of NuGet publishing. I added a ‘build’ folder for some build scripts, but that is the name of an output folder for python projects. Since the solution had no python code, I just commented that line out from the gitignore file. You could delete all the sections for languages you are not using in your repository, but this was the only time it mattered for me. You’ll find out if you need to remove some ignore settings when you are adding a file and it does not appear in the changes to commit list.


Using Github for Windows with other repository hosting providers is easy to setup and the interface is much easier to use than the git shell or git bash. I use it to work with both github and bitbucket repository hosting.


Github for Windows official site

Github starter documentation

Hosting Git repositories, The Easy (and Secure) Way

Public Git hosting sites with comparisons

Alternate directions: Setup Git and GitHub for Windows 7 for use with Bitbucket (Faison Zutavern)

Github for Windows Recent Improvements (Feb 21, 2013)
(Drag and Drop URLs to Clone Repositories)

About the Author

Michael Lang

Co-Founder and CTO of Watchdog Creative, business development, technology vision, and more since 2013, Developer, and Mentor since 1999. See the about page for more details.

1 Comment