带有多个存储库的Git Instaweb无法正常工作 [英] Git instaweb with multiple repositories not working
问题描述
我通过grok镜像填充了以下结构:
I have the following estructure which is populated via grok mirror:
/var/opt/git/git-data/repositories
/organization1
/teamA
/repo1
/repo2
/teamB
/repo3
/repo4
/organizationN
/teamN
/repoN
git instaweb适用于单个存储库,但是如果我想自动git instaweb在存储库"目录下显示所有存储库,则不起作用:
git instaweb works fine for a individual repo but if I want to automatically git instaweb shows all repos under "repositories" dir it doesnt' work:
fatal: Not a git repository (or any parent up to mount point /var/opt/git/git-data)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
这是正确的,因为在父目录中没有存储库,但是如果我从/var/opt/git/git-data/repositories/organization/teamA/
执行git instaweb
,则会遇到相同的错误,并且该目录内是裸存储库所在的目录(每个存储库都有一个repoN.git目录)回购)
Which is true because there is no repo in the parent directory, but if I execute git instaweb
from /var/opt/git/git-data/repositories/organization/teamA/
I get the same error and inside that directory is where the bare repos resides (a repoN.git directory for each repo)
我已将GIT_DISCOVERY_ACROSS_FILESYSTEM
env var设置为无结果.
我还为/etc/gitweb.conf
设置了以下条目:our $projectroot = "/var/opt/git/git-data/repositories";
I have set GIT_DISCOVERY_ACROSS_FILESYSTEM
env var without results.
Also I have set /etc/gitweb.conf
the following entry: our $projectroot = "/var/opt/git/git-data/repositories";
正如我在项目文档中所读到的,git instaweb可以服务于多个存储库,而不仅仅是一个存储库,它可以在特定目录下查找存储库.
As I have read in doc of the project, git instaweb can serve for multiple repos, not only one and it looks for repos under certain directory.
我在做什么错了?
推荐答案
我通过创建一个空的存储库并链接到我要浏览的存储库来做到这一点.由于instaweb运行gitweb并设置项目根目录的复杂方式,因此必须采取这种解决方法.
I do this by creating an empty repository and linking to the repositories I want to browse. This workaround is necessary because of the complicated way instaweb runs gitweb and sets the project root.
git init instaweb
cd instaweb
ln -s /var/opt/git/git-data/repositories/org1/teama/repo1 repo1-a-1
ln -s /var/opt/git/git-data/repositories/org2/teamb/repo2 repo2-b-2
git instaweb --httpd webrick
服务器现在已经启动并运行,并且主页上将列出一个.git项目(这是您刚初始化的空存储库)以及您链接到的两个实际项目.
The server is up and running now and the homepage will list a .git project (which is the empty repository you just initialised) along with the two actual projects you linked to.
这篇关于带有多个存储库的Git Instaweb无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!