简体   繁体   English

什么是 git 守护进程?

[英]What is git-daemon?

What is git-daemon?什么是 git 守护进程? Is it a default git function?它是默认的 git 函数吗? 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.到目前为止,我能够将“--bare”存储库克隆到 Apache 服务器上,然后使用“update-server-info”来允许将存储库克隆给其他协作者。 However, this does not let collaborators push their commits to the "--bare" repository.但是,这不会让协作者将他们的提交推送到“--bare”存储库。

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."我在“--bare”存储库中创建了“git-daemon-export-ok”文件,并运行了命令:“git-daemon --verbose /git”,但出现错误:“git-daemon: command not成立。”

Any help would be appreciated.任何帮助,将不胜感激。

man git-daemon will tell you quite a bit (and yes, it is a built-in that comes with Git). man git-daemon会告诉你很多(是的,它是 Git 自带的)。 Git daemon is run via git daemon (notice no hyphen). Git 守护进程通过git daemon运行(注意没有连字符)。

However, you should take a look at Gitolite or similar if you intend on hosting Git repositories on a server.但是,如果您打算在服务器上托管 Git 存储库,则应该查看Gitolite类似软件

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!只需从原始存储库克隆!

On your server, in each repository, say, /opt/git/myrepository.git, there is a config file.在您的服务器上,在每个存储库中,例如 /opt/git/myrepository.git,都有一个配置文件。

Add the following section添加以下部分

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

From the kernel.org page on git-daemon来自git-daemon 上的 kernel.org 页面

You could have a detailed understanding by reading https://www.kernel.org/pub/software/scm/git/docs/git-daemon.html您可以通过阅读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.至于问题git daemon not a git command你可以阅读这篇关于如何安装它的文章。 http://androidyue.github.io/blog/2013/09/10/install-git-daemon-on-fedora/ http://androidyue.github.io/blog/2013/09/10/install-git-daemon-on-fedora/

Hope this could help you.希望这可以帮助你。

git daemon could also be used for purpose of migration to an other service provider. git daemon也可用于迁移到其他服务提供商。

  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在 github 的情况下,您必须将存储库 url 选择的存储库放入表单Import your project to GitHub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM