Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting Git Repository in Windows

Tags:

git

windows

Is there currently a way to host a shared Git repository in Windows? I understand that you can configure the Git service in Linux with:

git daemon 

Is there a native Windows option, short of sharing folders, to host a Git service?

EDIT: I am currently using the cygwin install of git to store and work with git repositories in Windows, but I would like to take the next step of hosting a repository with a service that can provide access to others.

like image 717
Jeff Fritz Avatar asked Oct 24 '08 12:10

Jeff Fritz


People also ask

Where are git repositories stored Windows?

git folder is store in ~/common/. git ( common is the name of the package).


2 Answers

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 
like image 158
Derek Greer Avatar answered Sep 30 '22 17:09

Derek Greer


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

like image 43
poiuytrez Avatar answered Sep 30 '22 17:09

poiuytrez