(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=43272275
PuTTY 的作者 Simon Tatham 阐述了他偏好将 Git 仓库作为静态文件,通过简单的 Web 服务器提供服务,避免使用动态代码以增强安全性并简化维护。他使用 `git update-server-info` 命令和 post-receive hook 来保持公共仓库的更新。他还更喜欢通过电子邮件进行贡献,认为 Forge 账户创建和拉取请求系统过于限制。他建议使用诸如发送 Git 仓库 URL 和分支名称,或者使用 `git bundle` 等替代方案。虽然承认这种方法存在挑战,但他看重这种方法带来的控制力和去中心化优势。
Hacker News 的讨论辩论了这种“无 Forge 的 Git”方法的优缺点。一些用户欣赏其轻量级特性以及避免使用中心化平台的优势。另一些人则强调了像 Gitea 这样的 Forge 的便利性和功能,以及现代 GUI 驱动的协作工作流程的益处。基于电子邮件的工作流程的挑战,特别是补丁管理和审查,也受到了讨论。Fossil、Radicle 和 Forgejo 等替代方案被提及,同时还提出了中心化方法以及不需要去中心化的观点。
I host my own public Git repositories, but statically--read-only, no HTML views. I don't want to run any specialized server-side code, whether dynamic or preprocessed, as that's a security vector and system administration maintenance headache I don't want to deal with. You can host a Git repository as a set of static files using any web server, without any special configuration. Just clone a bare repo into an existing visible directory. `git update-server-info` generates the necessary index files for `git clone https://...` to work transparently. I add a post-receive hook to my read-write Git repositories that does `cd /path/to/mirror.git && git fetch && git --bare update-server-info` to keep the public repo updated.
In theory something like gitweb could be implemented purely client-side, using JavaScript or WASM to fetch the Git indices and packs on-demand and generate the HTML views. Some day I'd like to give that a try if someone doesn't beat me to it. You could even serve it as index.html from the Git repository directory, so the browser app and the Git clone URL are identical.
reply