When I first started this blog back in 2008 I had a little memory stick where I would copy a “date named” zip file of my source code directory.  Not the cleanest of solutions but it worked…sort of.  Over time I have used VSS, TFS, bitbucket –stash-, and a git repo stored on a different memory stick for my personal projects.  What I have found was I did not care for VSS or TFS and I like working with git based source control.

So when my Memory stick died –yes they do that- and I had to deal with pulling files off a computer that I do not use anymore, I decided it was time use something a little better. 

I started by reviewing my requirements

  I thought about all of the things that can happen –fire, flood, act of cats…) and added a few requirements

I was surprised to find a lack of projects that met my requirements.  I was about to toss in the towel and look at Bitbucket when I stumbled on Bonobo on github.  Note- the irony of a git server being hosted on github is not lost on me. 

Requirement

Finding

Open source The project is hosted on GitHub.com with the source code freely available for download.
Free Licensed under MIT and their main site even calls it out as open and free…
Built on .net It is written in C#. 
Use existing infrastructure I can run it in a virtual directory on my web host.
Off-site files Since it is on my web host the files are remote and stored outside of my house.
Ease of backups Backing up files from my host is easy so I do not have to worry about it.
Git based It is a git server…that is perfect.

I cloned the repository from GitHub.com and started looking at my options.  By default it uses SQLite and stores the database and repositories in the app_data directory but it has support for SQL and you can change the repository path.  So a few web.config edits later I was able get the repo up and running.  After changing the password and tinkering with it for a while I found a problem that surprised me.  When creating a repository you can specify that anonymous users can pull the code but that is only through a git client (or command line).  It turns out that the web UI has very nice repository browser but it requires the user to be logged in.  I have no desire to require –or allow- people to register in my git server.  In the projects issue tracker I found Issue 77 which is exactly what I’ve run into and want to fix.

This is why I want open source .net solutions, I put together some code changes and submitted a pull request to allow anonymous users to browse repositories.  Granted I forgot to update a couple of unit tests and had to add a commit to fix them… but it works.

I did ran the unit tests locally but it also ran integration tests.  The selenium driver had some issues with my windows 10/IE11 and failed a lot of the tests.  I let the projects AppVeyor validation on github run the tests for me and it reported which ones were broken.  Interestingly, I found that the tests failed because I set the zoom on my IE to be 200% and the test driver did not care for that at all.  There was also a call to IWebElement.Click() that was failing to check a checkbox before form.Submit() was being called.  I added a bit of trickery to simulate typing in the field and passed it a space (“ “) which caused the box to check correctly. Only 2 integration tests were really failing and that was because the repository index no-longer required a logged in user.  After finding a different page that requires an authenticated user and updating the tests to use that URL it seemed to be all set.

So that’s another item off my list… if you need a self hosted git repo you should consider Bonobo; it is quick and east.

Happy coding!