How to start git daemon on Windows
Asked Answered
P

4

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.

Profit answered 3/3, 2011 at 20:18 Comment(1)
See my answer here: #233921Excerpt
P
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

Profile answered 4/3, 2011 at 20:3 Comment(5)
If you are standing in a git repository and starting the daemon, as you wrote. What should the /path/to/repo be?Fernanda
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.Profile
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.Forget
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!Posset
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.Profile
G
7

You could use SCM-Manager instead of git daemon.

Greaves answered 4/3, 2011 at 12:55 Comment(1)
Thanks for this. Serving git on Windows really is a PITA, but this tool made it quick and easy.Aiden
A
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.

Arnst answered 12/11, 2021 at 21:24 Comment(0)
S
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.

Squatter answered 13/3, 2022 at 12:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.