设置对 git repo 的只读 http 访问 [英] Setting up read-only http access to git repo

查看:27
本文介绍了设置对 git repo 的只读 http 访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能拥有一个可以通过 http 访问但只能用于克隆的远程 git 存储库?也许在 nginx(已经运行)和 git-http-backend(git-http-fetch ?)的帮助下.

how can I have a remote git repo which is accessible via http but only for cloning? Maybe with the help of nginx (already running) and git-http-backend (git-http-fetch ?).

推荐答案

注意:我假设您指的是匿名只读访问;我认为在 git 中没有办法区分 clone 和 fetch.

NOTE: I assume that you meant anonymous read-only access; there is no way to distinguish between clone and fetch in git, I think.

您要设置智能"HTTP(推荐)还是愚蠢"HTTP?

Do you want to set up "smart" HTTP (recommended), or "dumb" HTTP one?

对于哑"HTTP,禁止(或只是不设置)WebDAV 就足够了——这就是哑"HTTP 推送的方式(服务器端没有 git).

For "dumb" HTTP it is enough to forbid (or just do not set up) WebDAV - this is how pushes come with "dumb" HTTP (no git on server side).

对于智能"HTTP,请遵循git-http-backend 联机帮助页,将其从 Apache 翻译为 nginx,并稍作修改.请注意,匿名读取但经过身份验证的写入的文档可能不完整,但无论如何您不必担心经过身份验证的写入(推送)访问会成功,不是吗?

For "smart" HTTP follow directions for anonymous read access but authenticated write access in git-http-backend manpage, translating it from Apache to nginx, and modifying slightly. Note that documentation for anonymous read but authenticated write might be incomplete, but you do not worry about authenthicated write (push) access succeding anyway, isn't it?

这篇关于设置对 git repo 的只读 http 访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆