使用 http 客户端直接从 gitolite 托管的 git 存储库访问文件

Access file from gitolite-hosted git repository directly using http client

我正在使用 gitolite 托管 git 存储库,并设置了两个 ssh and http access. I can clone repositories over ssh and http using the git cli. Now, I need to be able to load a file from the git repository over http without using the git client. Specifically, I need to provide the URL https://git.example.com/myproject/locale/en/LC_MESSAGES/default.po to the Transifex 翻译服务,以便它可以轮询 .po 消息文件的更改。

有没有一种简单的方法可以直接使用 http 客户端访问此文件?

我已经尝试过的一个选项:我们正在使用 Trac,它有一个内置的源代码浏览器并为原始文件提供 links,但每个 URL 都绑定到一个特定的修订散列(example),没有选项 link 到 "latest" 文件。

我考虑过设置一个 post-receive 挂钩来将此文件(或整个存储库)导出到 Web 可访问的位置。但是,我想知道是否可以通过 gitolite 直接访问存储库中的文件,而不是像这样的解决方法。

Git 将修订建模为 graph(即连接的节点),而不是像一大堆煎饼。 Git 中没有 "latest" 提交。有最新的提交日期,但这可能不是你想要的,而且要找到它也不是一件容易的事。您的意思可能是 master 分支的尖端。

一般来说,anything in Git that takes a hash (ie. 51e037aedb09735106f2e51520c3ff4430b663e3) will also take a reference (ie. master)。可以调整 URL 以导出该文件的 master 版本。

https://trac.strangecode.com/pulso/export/master/locale/en/LC_MESSAGES/default.po