使用 gitweb 发布多个 git 存储库
刚刚开始使用git。构建和安装它很容易。然后我进入我的一个 Web 项目的目录并向其中添加一个 git 存储库。
$ cd ~/Sites/webapp
$ git init (and so on)
我还设置了 gitweb,当我将 ~/Sites/webapp 添加到 gitweb.cgi 中的 $projectroot 设置时,当我访问 http://localhost/gitweb/gitweb.cgi
因此,我的问题是——据我了解,git 没有一个中央存储库概念。我可能正在从事的每个项目都会有自己的 git 存储库。由于我的项目遍布我的硬盘,因此它们各自的存储库也遍布硬盘。如何向 gitweb 添加多个存储库?我的所有存储库是否有某种中央注册表?我真的应该重新调整我的工作方式,并将所有项目移至中央目录吗?这是怎么做到的?
Have just started using git. Building and installing it was easy. Then I went into the directory of one of my web projects and added a git repo to it.
$ cd ~/Sites/webapp
$ git init (and so on)
I also set up gitweb, and when I added ~/Sites/webapp to $projectroot setting in gitweb.cgi, that appeared in my browser when I went to http://localhost/gitweb/gitweb.cgi
My question is thus -- from what I understand, git doesn't have a central repo concept. Every project that I may be working on will have its own git repository. Since my projects are all over my hard disk, their respective repos are also all over the hard disk. How do I add multiple repositories to gitweb? Is there some kind of central registry of all my repos? Should I really rejig how I work, and move all my projects to a central directory? How is this done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想迟到总比不来好。
我通过创建项目根目录并链接 git 存储库解决了这个问题。
project_root="/opt/gitweb"
在 /opt/gitweb 中
Better late then never I guess.
I solved it by creating a project root directory and linking the git repositories.
project_root="/opt/gitweb"
In /opt/gitweb
我通过创建一个空存储库并链接到我想要浏览的存储库来实现此目的。由于 instaweb 运行 gitweb 和设置项目根目录的方式很复杂,因此这种解决方法是必要的。
服务器现在已启动并正在运行,主页将列出一个 .git 项目(这是您刚刚初始化的空存储库)以及您链接到的两个实际项目。
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.
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.