多个存储库的 git 守护进程和访问控制

pek*_*pek 3 git

这是情况,我有一个名为 git 的文件夹,其中包含各种 --bare git 存储库。这是在我的服务器上,它是 CentOS 5。我家里的个人电脑是 Windows XP。

我想使用基于每个存储库的帐户将我的本地存储库推送到我的服务器。我一直在寻找几个小时没有运气。这是我所做的最接近的。

我通过键入以下内容在我的服务器上运行了一个守护进程:

git daemon --verbose --base-path=/path/to/git/parent/folder --export-all
Run Code Online (Sandbox Code Playgroud)

然后我使用 TortoiseGit 推送地址: git://myserver.com/project 并且我从守护进程中得到这个:

来自 XX.XX.XX.XX 的连接扩展
属性(22 字节)存在
请求
接收包为“/project”
“receive-pack”:服务未
为“/path/to/git/parent/project”
[XXXX]启用断开连接(有错误)

我使用 --enable=receive-pack 并成功地将我的本地存储库推送到服务器,但结果不是我想要的:即以用户身份登录。Receive-pack 使每个人都可以匿名推送到服务器。

我已经搜索了几个小时,但找不到如何为每个存储库独立配置帐户。我已经阅读了各种关于 SSH 的文章,但我不确定这是否是我想要的。据我所知,SSH 是通过在服务器上登录一个 linux 帐户(即 root、userA 等)来安全地连接到我的服务器,而这不是我想要的。

以 SVN 为例,通过 subversion,您可以使用您想要的帐户创建一个 .htpasswd 文件,仅用于该特定存储库。Git有类似的方法吗?

谢谢你。

Mic*_*kop 7

查看gitosis,这是一个 git 存储库托管应用程序。引用来自 gitosis 的 Debian 软件包的描述:

This package aims to make hosting git repositories easier and safer.
It manages multiple repositories under one user account, using SSH
keys to identify users. End users do not need shell accounts on the
server; they will talk to one shared account that will not let them
run arbitrary commands.
Run Code Online (Sandbox Code Playgroud)

你可以在http://eagain.net/gitweb/?p=git​​osis.git找到 gitosis 源

有关如何设置的文档:http : //scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

我对 gitosis 非常满意,我们在 grml 项目 ( http://grml.org/ ) 中使用它,有 100 多个存储库,并且运行良好,没有任何问题。