This weekend I felt the need to make myself an NSubstitute Automocker for StructureMap. The first thing to do was to download the sourcecode for StructureMap and NSubstitute. Both are being hosted on GitHub. because I wanted to fork StructureMap and add the Automocker to it I had to create an account on github, which is free. And then I had to install Git and download the code.

For those people that don’t know what Github is.

According to wikipedia.

GitHub is a web-based hosting service for projects that use the Git revision control system. It is written using Ruby on Rails by GitHub, Inc. (previously known as Logical Awesome) developers Chris Wanstrath, PJ Hyett, and Tom Preston-Werner. GitHub offers both commercial plans and free accounts for open source projects. According to the Git User’s Survey in 2009, GitHub is the most popular Git hosting site.2

The site provides social networking functionality like feeds, followers and the network graph to display how developers work on their versions of a repository.

GitHub also operates a pastebin-style site, wikis for the individual repositories and web pages that can be edited through a git repository.

As of January 2010[update], GitHub is operated under the name GitHub, Inc


I choose to install TortoiseGit to use as a client. But first you need to install PuTTy. And then you need to install msysgit. I installed the following version Git-

I was helped by this article.

Select the option Add “Git Bash here”

Select the option Run Git from the Windows Command Prompt

Select the option Use Windows style line endings

If it asks for PLink, locate plink.exe in your PuTTY install directory (e.g. C:Program FilesPuTTYplink.exe)

Then I installed TortoiseGit and rebooted.

SSH keys

GitHub uses SSH and so you need to generate keys. That’s where PuTTy comes in. You use PuttyGen to Generate a key pair. Just click on the Generate button and move the mouse a little.

Then Save the private key somewhere you can easily remember where you put it. And copy the text from the top textbox. Make sure you keep this text until you need it later on.

Now also add the key to pageant. Just do add key and point it to the private key file you saved.


Now you have to go to Github and create an account. Once you have your account you should first add the public key. You can add a public key in your account settings. You give it a name and you just copy in the public you copied a little earlier.

Now that you have all this setup you can go to the and click on the fork button. This will create a fork in your account. You can now go to you account and see the url you need to download it to you local repository.

You should now create a directory where you want to save you sourcecode and then you right click on a directory somewhere and select TortoiseGit -> Settings. Then in Git -> config you set your name and emailaddress, the one you used to create your Github account.


Then I decided to clone my github fork to my local repository. You give it the git url that you can copy paste from the github page. You set your local repository. And you point it to the private key file we created earlier.

For NSubstitute I just used the read only url and did not fork it since I don’t really need to change that code for now.


Well it was a lot of work for something so simple. Downloading all the files and installing them will take some time. Configuring everything is pretty easy and everything works pretty smooth if you don’t make any mistakes. But if you do make a mistake then be prepared to lose some time since error messages don’t always say what they should.