带有apache2.4 Centos 7的git

编程入门 行业动态 更新时间:2024-10-14 06:19:25
本文介绍了带有apache2.4 Centos 7的git-http-backend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试在我的apache服务器上设置一个Git服务器,但是它不起作用! 我得到以下git.conf

I try to set up a Git-server on my apache server but it dont work! I got the following git.conf

SetEnv GIT_PROJECT_ROOT /var/www/html/git/project1 SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ <Directory "/var/www/html/git/project1"> Options ExecCGI Indexes Require all granted </Directory> <LocationMatch "^/git/.*/git-receive-pack$"> AuthType Basic AuthName "Git Access" AuthUserFile /var/www/html/git/users/.htpasswd Require valid-user </LocationMatch>

我创建了一个用户,但无法访问该网站.

I created a user but I cant acces the site.

Forbidden You don't have permission to access /git/ on this server.

如果我评论第3行

#ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/

现在,我可以访问该站点并可以看到git存储库.有谁知道我该如何解决. 英语不是我的母语,所以请耐心等待我的文字. 感谢您的问候 山姆

Now I can acces the site and can see the git repository. Does anyone know how I can fix this. English isn't my first language so please be patient with my text. Thanks for reading best regards Sam

推荐答案

跟随 文档:

SetEnv GIT_PROJECT_ROOT /var/www/git

这应该是您拥有git repos的根文件夹(repo1.git,repo2.git等).不应为/git/project1,它看起来像是回购本身的名称.

This should be the root folder under which you have git repos (repo1.git, repo2.git, ...). It should not be /git/project1, which looks like the name of a repo itself.

因此,请尝试以下示例:

So try the example:

SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ <LocationMatch "^/git/.*/git-receive-pack$"> AuthType Basic AuthName "Git Access" Require group committers ... </LocationMatch>

注意:在进行交互式会话后,事实证明您需要确保:

Note: after an interactive session, it turns out you need to be sure that:

  • apache读取或提供的数据归apache:apache(chown -R)所有
  • SElinux(增强安全性的Linux)允许httpd服务读取Z: ls -Z
  • the data read or served by apache are owned by apache:apache (chown -R)
  • SElinux (Security-Enhanced Linux) allows the httpd service to read Z: ls -Z

如果稍后不包括httd_rw,则需要输入(如"为什么我的Apache只能访问根拥有的文件?),以更改其上下文:

If the later point does not include httd_rw, you need to type (as in "How come my Apache can only access root owned files?"), to change its context:

chcon -vR --type=httpd_sys_content_t /html/

更多推荐

带有apache2.4 Centos 7的git

本文发布于:2023-11-01 13:18:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549428.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Centos   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!