使用 gitweb 发布多个 git 存储库

发布于 2024-09-14 11:26:13 字数 505 浏览 1 评论 0原文

刚刚开始使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尽揽少女心 2024-09-21 11:26:13

我想迟到总比不来好。

我通过创建项目根目录并链接 git 存储库解决了这个问题。

project_root="/opt/gitweb"

在 /opt/gitweb 中

ln -s ~/Sites/webapp webapp.git
ln -s ~/someotherplace/whereitis/application appliation.git

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

ln -s ~/Sites/webapp webapp.git
ln -s ~/someotherplace/whereitis/application appliation.git
沫尐诺 2024-09-21 11:26:13

我通过创建一个空存储库并链接到我想要浏览的存储库来实现此目的。由于 instaweb 运行 gitweb 和设置项目根目录的方式很复杂,因此这种解决方法是必要的。

git init instaweb
cd instaweb
ln -s ~/projects/gitproj1 gitproj1
ln -s ~/projects/gitproj2 gitproj2
git instaweb --httpd webrick

服务器现在已启动并正在运行,主页将列出一个 .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.

git init instaweb
cd instaweb
ln -s ~/projects/gitproj1 gitproj1
ln -s ~/projects/gitproj2 gitproj2
git instaweb --httpd webrick

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文