Windows Github and Bitbucket setup
August 4, 2013
After I installed the Windows 8.1 update, and I kind of destroyed my machine and had to re-install Windows fresh. This was pretty easy, but I lost all the configuration I had setup for developing with Github and Bitbucket.
Installation of Tools
To solve my ssh requirement, which I use for both git and mercurial, I simply installed Putty, which I belive is pretty standard for ssh on windows. I opted to go with the Putty Installer. It should install a few different tools that will be necessary in the future.
Git for Windows has an installer which makes the git installation pretty simple. There are a few options that you can choose from and I recommend taking the time to actually read and learn about those options. One that is sometimes required for projects is core.autocrlf to ‘false’, I would recommend checking this box during the installation.
Hg ( Mercurial )
If you like GUI based tools for source management, I would recommend SourceTree, which I discovered when I started developing on a Macbook Pro. It has since been ported to Windows and is getting regular updates. It works well with both Git and Hg. Also, allows you to connect your github and/or bitbucket account. Of course there are alternatives, like tortoise GUI’s ( TortoiseGit and TortoiseHg ).
SSH key generation
Open up puttygen, which was installed with the putty installer as well as the chocolatey install. Click generate and then follow the instructions ( you have to move your mouse randomly ). After the key is generated, you should save the private key and copy the public key info near the top of the puttygen dialog. I chose to save them in a
.ssh directory in my home directory ( this is consistent with Linux and Mac based systems ).
Associate SSH key with account
Both git and bitbucket can use ssh for establishing identity.
- Login to your github account
- Go to account settings from the top right corner.
- On the left menu click ssh keys
- Press ‘Add Key’
- Give the key an appropriate name
- Paste the public key you copied earlier
- Login to your bitbucket account
- From the top right dropdown select ‘Manage Account’
- From the left menu click ‘SSH keys’
- If you have linked your github and bitbucket accounts you can just press ‘import keys from Github’
- If you have not, you can click ‘Add key’
- Give the key an appropriate name
- Paste the public key that you copied earlier
Pageant SSH key on startup
If you do a lot of development and would rahter not have to worry about running pageant and loading the ssh key everytime you want to do something, than you can create a script in your “startup” folder. To locate the startup folder the fastest method I have found is to press
win + r and type
shell:startup and press enter. This will get you to the correct folder. For me I made a simple “Start Pageant.bat” script, that contains the following :
Note : make sure to change the path to the key file so that the correct ppk file is used by pageant.
SSH config for hg and git
To use the correct agent for SSH with Git for Windows you need to set an environment variable. Add an environment variable GIT_SSH=\Path\to\plink.exe. Plink will use the ssh key that was loaded into pageant.
To use the plink with hg you must add it to the mercurial config file. This is pretty simple, open up the mercurial.ini file that is located in your home directory. Under the [ui] section, add
Also, if you want command line capabilities with Mercurial you will need to add it to your PATH environment variables, this is not done during the installation.
Now that you are ready to contribute, go make your mark on the internet community!
I just started to really try and get involved in some open source software. It has been pretty rewarding and a great learning experience. I would recommend it to any software engineer, inexperienced or expert.