设置对 git repo 的只读 http 访问

blo*_*ock 4 git nginx

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

ach*_*zot 5

也许这就是您要找的东西git daemonGit serve:我希望就这么简单

该页面上有许多有趣的答案,但没有一个专门针对 nginx。

然后你可以像这样在 nginx 中添加一个代理传递:

location / {
  proxy_set_header Host $host;
  proxy_pass  http://127.0.0.1:9418; # Port 9418 is the default git daemon port
}
Run Code Online (Sandbox Code Playgroud)

我不知道只允许克隆的方法......但该git daemon命令已经是只读的。所以它应该做它的工作。

我希望这有帮助 !