Configure Git on Windows Server 2008/2012

On the server

The server configuration is the following.

1. Download the portable version of msysgit (from: http://code.google.com/p/msysgit/downloads/list) and extract it to C:\Git.

2. Add C:\Git\bin to the PATH variable.
(If you don’t want to use the portable msysgit for whatever reason, you also have to add C:\Git\libexec\git-core to the PATH)

3. Create a new file in C:\Git\bin and just insert

$*

Save it as shell script (.sh). E.g. “gitcmdhelper.sh”.
This basically executes the all parameters that are passed and solves the quotes-problem. There are surely other approaches to solve this issue and if you find a better one please do not hesitate to post a comment.

4. Install WinSSHD from http://www.bitvise.com/ssh-server-download. In WinSSHD open the advanced settings and edit the user account(s) you have set up before. Scroll down a bit and uncheck “Use group default exec request prefix”. Then change the “Exec request prefix” to

cmd.exe /c sh gitcmdhelper.sh

Be sure to add a space at the end.
5. Install msysgit from http://code.google.com/p/msysgit/downloads/list (with Git Bash option)
6. Open Git Bash and run the following commands.

   mkdir /d/Git/git_repo1
   cd /d/Git/git_repo1

   git init --bare

On the Client

1. Install msysgit from http://code.google.com/p/msysgit/downloads/list (with Git Bash option)
2. Run the following commands

   mkdir git_repo1
   cd git_repo1

   git init
   git add .
   // create test.txt in vi
   git commit -m "Added test.txt"
   git remote add origin user@ip:/d/Git/git_repo1
   git push origin master

The above commands will push the repo to the central repository.