Hosting Git Repository in Windows

Here's a dedicated git server for windows: https://github.com/jakubgarfield/Bonobo-Git-Server/wiki


If you are working in a Windows environment, have you considered Mercurial? It is a distributed version control system like Git, but integrates far more neatly and easily with Windows.


GitStack might be your best choice. It is currently free (for up to 2 users) and open source at the time of writing.


Here are some steps you can follow to get the git daemon running under Windows:

(Prerequisites: A default Cygwin installation and a git client that supports git daemon)

Step 1: Open a bash shell

Step 2: In the directory /cygdrive/c/cygwin64/usr/local/bin/, create a file named "gitd" with the following content:

#!/bin/bash

/usr/bin/git daemon --reuseaddr --base-path=/git --export-all --verbose --enable=receive-pack

Step 3: Run the following cygrunsrv command from an elevated prompt (i.e. as admin) to install the script as a service (Note: assumes Cygwin is installed at C:\cygwin64):

cygrunsrv   --install gitd                          \
            --path c:/cygwin64/bin/bash.exe         \
            --args c:/cygwin64/usr/local/bin/gitd   \
            --desc "Git Daemon"                     \
            --neverexits                            \
            --shutdown

Step 4: Run the following command to start the service:

cygrunsrv --start gitd

You are done. If you want to test it, here is a quick and dirty script that shows that you can push over the git protocol to your local machine:

#!/bin/bash

echo "Creating main git repo ..."
mkdir -p /git/testapp.git
cd /git/testapp.git
git init --bare
touch git-daemon-export-ok
echo "Creating local repo ..."
cd
mkdir testapp
cd testapp
git init
echo "Creating test file ..."
touch testfile
git add -A
git commit -m 'Test message'
echo "Pushing master to main repo ..."
git push git://localhost/testapp.git master

Tags:

Windows

Git