Gitweb 无法正确显示

发布于 2024-12-01 00:56:24 字数 1314 浏览 2 评论 0原文

我尝试设置 gitweb,但是当我加载页面时,结果很奇怪...

在此处输入图像描述


编辑:以防人们误解,它应该是这样的: 在此处输入图像描述


这是我的 lighttpd 配置文件的样子:

server.port = 80
server.username = "http"
server.groupname = "http"
server.document-root = "/usr/share/gitweb"
server.errorlog = "/var/log/lighttpd/error.log"
dir-listing.activate = "enable"
index-file.names = ( "gitweb.cgi" )
cgi.assign = (
    ".cgi" => ""
)
mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".png" => "image/png"
)
server.modules += (
    "mod_cgi",
    "mod_setenv"
)
setenv.add-environment = (
    "GITWEB_CONFIG" => "/etc/conf.d/gitweb.conf"
)

这就是 gitweb.conf 的样子:

$git_temp = "/tmp";

# The directories where your projects are. Must not end with a slash.
$projectroot = "/path/to/projects";

# Base URLs for links displayed in the web interface.
our @git_base_url_list = qw(git://localhost http://git@localhost);

(/path/to/projects 只是为了给你一个想法。)

当我使用 git instaweb 时,结果似乎很好,尽管看起来它忽略了新的我正在尝试使用的 gitweb.css 文件。 编辑:这是因为我没有更新缓存。

有什么想法吗?

I tried setting up gitweb, but when I load the page, it comes out weird...

enter image description here


Edit: In case people misunderstood, this is what it should look like:
enter image description here


This is what my lighttpd configuration file looks like:

server.port = 80
server.username = "http"
server.groupname = "http"
server.document-root = "/usr/share/gitweb"
server.errorlog = "/var/log/lighttpd/error.log"
dir-listing.activate = "enable"
index-file.names = ( "gitweb.cgi" )
cgi.assign = (
    ".cgi" => ""
)
mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".png" => "image/png"
)
server.modules += (
    "mod_cgi",
    "mod_setenv"
)
setenv.add-environment = (
    "GITWEB_CONFIG" => "/etc/conf.d/gitweb.conf"
)

This is what gitweb.conf looks like:

$git_temp = "/tmp";

# The directories where your projects are. Must not end with a slash.
$projectroot = "/path/to/projects";

# Base URLs for links displayed in the web interface.
our @git_base_url_list = qw(git://localhost http://git@localhost);

(/path/to/projects is just to give you an idea.)

When I use git instaweb, it seems to come out fine, although it looks like it's ignoring the new gitweb.css file that I'm trying to use. Edit: It's because I didn't update the cache.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

冬天的雪花 2024-12-08 00:56:25

问题是 CSS 文档没有被正确识别。

mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".png" => "image/png",
    ".css" => "text/css"
)

需要设置 mime 类型。

The problem is that CSS documents aren't being recognized properly.

mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".png" => "image/png",
    ".css" => "text/css"
)

The mime type needed to be set.

跨年 2024-12-08 00:56:25

gitweb 仅适用于裸存储库。所以请确保你有一个。您的屏幕截图看起来像是您已经创建了一个具有完整工作树的存储库,并指向该目录。

编辑
当前版本的 gitweb 也可​​以在非裸机上运行,​​但您的系统可能有旧版本。

缺少的存储库名称可以在 git-config 中配置:

[gitweb]
  description = "My Repository Description"
  cloneurl    = git://here.you.could/clone/me.git
  owner       = "Me"

还有更多可用的配置参数,只需查看文档(在 /usr/share/doc/git* 下)

gitweb works only on bare repositories. So make sure you have one. Your screen-shot looks like you have created one repository with full working tree, and pointing to this directory.

EDIT
The current version of gitweb works on non-bare also, but your system may have an older one.

The missing name of the repository could be configured in your git-config:

[gitweb]
  description = "My Repository Description"
  cloneurl    = git://here.you.could/clone/me.git
  owner       = "Me"

There are more config parameters available, just have a look at the documentation (under /usr/share/doc/git*)

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