3

我正在尝试在我和朋友都可以访问的共享主机帐户上设置一个 git 存储库。通过将此行添加到 ~/.ssh/authorized_keys,我已经成功地使用 Subversion 存储库完成了此操作:

command="/usr/bin/svnserve -t -r /path/to/svn/repo \
  --tunnel-user=myfriend",no-port-forwarding,no-agent-forwarding,\
  no-X11-forwarding,no-pty [ssh key]

到目前为止,我已经了解到 git-shell 是 git 的 svnserve 等价物,但似乎没有 -r 选项的等价物来限制对特定路径的访问。这是有问题的,因为我不希望我的朋友访问其他 git 存储库。

我已经简要地阅读了有关 gitosis 的内容,它似乎能够做我想做的事,但我想看看是否有更简单的解决方案,然后再尝试设置另一款软件来完成这一特定要求。提前致谢!

编辑:我发现这篇文章提供了一个脚本来做到这一点:

http://eagain.net/blog/2007/03/22/howto-host-git.html

但实际上,它是由后来编写 gitosis 并被标记为过时的同一个人编写的。在我的情况下,gitosis 似乎也是不可能的,因为它需要创建一个专用的 UNIX 用户,而我无法使用共享主机帐户。但是,如果我误解了这些,我很乐意被证明是错误的!

4

3 回答 3

2

以下是一些选项:

  • 控制用户可以使用普通 Unix 权限访问哪些存储库。

  • 使用受限登录 shell,例如rssh,并让您的朋友使用rsync://他的遥控器的 URL。

  • Serve the repository over HTTP or HTTPS with a username and password to protect it. You'll want to enable the git hook for updating the metadata.

于 2010-01-03T01:37:50.943 回答
0

我认为它比这更简单:设置远程 git 存储库

于 2010-01-03T00:28:48.963 回答
0

Gitosis was replaced by Gitolite.

The account does not have to be dedicated, it can be configured to properly preserve additional authorized keys.

于 2014-05-21T15:37:36.193 回答