Simple guide to running Git server on Windows, in local network (kind of)

Last year I found myself in a sudden and quick need to set up working environment for a team of four, and as I like Git very much, I wanted to use it as our VCS. The problem was, we weren’t allowed to use any third party provider, so GitHub was off the table. As I searched the Internet there were a few guides to set up team Git environment on Windows, but they all seemed very complicated and time consuming. For our modest needs we experimented a little and came up with a solution that was very simple, didn’t require any additional software to be installed anywhere and worked like a charm.

Recently I used it again on my current engagement, and one of my colleagues suggested I should blog it, so here goes.

Ready, steady, go

The guide assumes you already have your local Git set up. For that, there are plenty of resources on the Internet, including my own blogpost about Windows Git tooling.

The entire tricks works like this – expose folder containing your shared Git repository as Windows network share.

Step one – bare git repository

There are two twists to the entire solution – one of them is – your shared repository needs to be initialized with --bare flag.

git_bare_repository

Step two – Windows share

Second step is to expose the folder with our newly created repository on the Windows share. You also use your standard Windows mechanisms to control and limit access to the folder (make sure you give the developers write access!).

Step three – Map the share as network drive

This step is perhaps not exactly necessary but I couldn’t get it to work otherwise, so here comes the second twist. In order for your developers to be able to access the shared folder via Git they need to map it as network drive.

sshot-10

Step four – Add remote repository in Git and code away

Last step is the standard Git procedure – every developer on your team needs to add the repository sitting under their newly created network drive as remote. Notice the use of “file:///” prefix in front of the mapped drive name.

sshot-11

 

 

 

Step five

That’s all. I hope you find it useful, and if you know a way to eliminate step three, let me know in the comments.


Posted 08-20-2011 9:50 AM by Krzysztof Koźmic

[Advertisement]

Comments

Brad wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 08-20-2011 4:39 AM

Nice write up and fairly simple, given the tooling involved.  

They really need a proper client for Git that is not command line based.  We need to be beyond command line by now.

Mike P. wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 08-20-2011 5:53 AM

Great post!  After a bit of digging I was able to remove your step 3.  When adding the remote use this syntax:

$ git remote add shared "//xtoff-pc/remote"

Corey wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 08-20-2011 9:04 AM

Another way to remove the network drive is to just use the file style URI. file:///\\path-to-\\windows-share

Thomas Freudenberg wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 08-22-2011 5:54 AM

I use git-dot-aspx by Jeremy Skinner to host git in IIS: github.com/.../git-dot-aspx

Endy wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 11-30-2011 3:55 AM

Suppose more than one developer commit to the repo at the same time, can this setup handle it?

Gitstack wrote re: Simple guide to running Git server on Windows, in local network (kind of)
on 02-21-2012 7:38 AM

Hi,

We currently work on a very simple software solution to install a Git Server on Windows.

If you have time, you can take a look : http://gitstack.com.

Regards,

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)