What is git-daemon?

2019-06-22 12:53发布

问题:

What is git-daemon? Is it a default git function? I am trying to understand this so that I can host a repository on a server that people can push/pull from.

So far I am able to clone a "--bare" repository onto an Apache server, and then use "update-server-info" to allow the repository to be cloned to other collaborators. However, this does not let collaborators push their commits to the "--bare" repository.

I created the "git-daemon-export-ok" file in my "--bare" repository, and ran the command: "git-daemon --verbose /git" but I get an error: "git-daemon: command not found."

Any help would be appreciated.

回答1:

man git-daemon will tell you quite a bit (and yes, it is a built-in that comes with Git). Git daemon is run via git daemon (notice no hyphen).

However, you should take a look at Gitolite if you intend on hosting Git repositories on a server.

Further, why are you cloning a repository with the intention of having that cloned, and any pushes to it forwarded to the repo it was cloned from? Just clone from the original repository!



回答2:

On your server, in each repository, say, /opt/git/myrepository.git, there is a config file.

Add the following section

[daemon]
    uploadpack = true
    uploadarch = true
    receivepack = true

From the kernel.org page on git-daemon



回答3:

You could have a detailed understanding by reading https://www.kernel.org/pub/software/scm/git/docs/git-daemon.html

As to the problem git daemon not a git command you could read this post about how to installing it.http://androidyue.github.io/blog/2013/09/10/install-git-daemon-on-fedora/

Hope this could help you.



回答4:

git daemon could also be used for purpose of migration to an other service provider.

  1. local environment setup
find PATH-TO-LOCAL-REPOSITORIES-ROOT -maxdepth 1 -mindepth 1 -type d -exec touch {}/.git/git-daemon-export-ok  \;
git daemon --verbose PATH-TO-LOCAL-REPOSITORIES-ROOT/*
  1. In case of github you have to put the repository url chosen repository into the form Import your project to GitHub