25

How do I start the git daemon on Windows in order to allow it to begin serving requests? Seems like msysgit is supposed to install it as a Windows Service or something but I don't see one.

1

4 Answers 4

32

Git for Windows 1.7.4 includes support for git daemon on windows which was missing in previous versions. To export your repository you will need to create a file called git-daemon-export-ok in the .git directory or include the --export-all command line option.

In a git repository run:git daemon --export-all and you can then connect to it from a remote machine eg: git ls-remote git://yourmachine/path/to/repo

5
  • If you are standing in a git repository and starting the daemon, as you wrote. What should the /path/to/repo be?
    – corgrath
    May 10, 2011 at 13:11
  • 12
    Git the full local path to the working directory. So if your code is in c:\src\CoolProject and you start git daemon in that folder, git ls-remote git://yourmachine/src/CoolProject should list the available refs.
    – patthoyts
    May 17, 2011 at 13:51
  • 5
    If your path still isn't working, try explicitly setting your base path like this: git daemon --base-path=/c/Users/Tyler/workplace. Then, assuming your repo is in C:\Users\Tyler\workplace\src\CoolProject, you can try git ls-remote git://yourmachine/src/CoolProject.
    – Tyler
    Jun 14, 2013 at 17:59
  • sorry, how much RAM does the git daemon occupy in windows? I'm building a business case for my work and I'm in a catch-22... thanks!
    – matao
    Nov 17, 2014 at 1:48
  • The running process occupies around 2MB RAM when I run it locally. It will memory map the pack files so more memory is better as it reduces the number of reads from the hard disk but it will depend on how big the repository is.
    – patthoyts
    Nov 17, 2014 at 12:07
7

You could use SCM-Manager instead of git daemon.

1
  • Thanks for this. Serving git on Windows really is a PITA, but this tool made it quick and easy.
    – dvdgsng
    Nov 25, 2014 at 14:45
1

With Git 2.34 (Q4 2021), as part of the new built-in fsmonitor, starting a Git daemon on Windows will be easier:

See commit 05881a6, commit fdb1322, commit 8750249, commit 9bd51d4, commit a3e2033, commit 64bc752 (20 Sep 2021) by Jeff Hostetler (Jeff-Hostetler).
See commit 59c9232 (20 Sep 2021) by Carlo Marcelo Arenas Belón (carenas).
(Merged by Junio C Hamano -- gitster -- in commit af303ee, 13 Oct 2021)

simple-ipc/ipc-win32: add Windows ACL to named pipe

Signed-off-by: Jeff Hostetler

Set an ACL on the named pipe to allow the well-known group EVERYONE to read and write to the IPC server's named pipe.

In the event that the daemon was started with elevation, allow non-elevated clients to communicate with the daemon.

0

I've had an issue with this same problem. So I spent my Saturday (because I have no life) putting together a solution :)

I've uploaded self-contained .NET Core worker app that can be installed as a windows service here.

Currently, it's very basic and will configure the Daemon to read-only, if you want to be able to push back where-ever your git remote is hosted, add the tag --enable-receive-pack to line 9 in worker.cs and recompile.

To broadcast a specific location on your host, on the same line, add --base-path=C:\Path\To\Repo.

I'll probably make some improvement on this in the future for extra configurability :)

**edit: Needs git installed on the host machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.