Ubuntu 上的 viewgit 权限问题
我在 Ubuntu 服务器上安装了 Gitosis 和 Viewgit。 Git 和 Gitosis 工作得很好。虽然当我尝试在浏览器中打开 /viewgit 界面时出现错误:
viewgit/inc/functions.php:66 file_get_contents(/var/git/repositories/test.git/description): 无法打开流: 权限被拒绝 [2]
ls -l 给我以下内容:
root@***:/var/git/repositories# ls -l
drwxr-x--- 8 git git 4096 12. Okt 22:26 gitosis-admin.git
drwxr-x--- 7 git git 4096 12. Okt 22:36 test.git
cd test.git
root@***:/var/git/repositories/test.git# ls -l
drwxr-xr-x 2 git git 4096 12. Okt 22:36 branches
-rw-r--r-- 1 git git 66 12. Okt 22:36 config
-rw-r--r-- 1 git git 18 12. Okt 22:36 description
-rw-r--r-- 1 git git 23 12. Okt 22:36 HEAD
drwxr-xr-x 2 git git 4096 12. Okt 22:36 hooks
drwxr-xr-x 2 git git 4096 12. Okt 22:36 info
drwxr-xr-x 4 git git 4096 12. Okt 22:36 objects
drwxr-xr-x 4 git git 4096 12. Okt 22:36 refs
用户和组总是 git:git。有什么想法吗?是不是我必须添加 www-data 用户?我不是一个非常有经验的 Ubuntu 用户,但我一直在努力。
编辑:我在描述上做了一个chmod 777
,现在它工作正常。这是要走的路吗?
I installed Gitosis and Viewgit on an Ubuntu Server. Git and Gitosis work just fine. Though when I try to open /viewgit interface in my browser I get an error:
viewgit/inc/functions.php:66 file_get_contents(/var/git/repositories/test.git/description): failed to open stream: Permission denied [2]
An ls -l gives me following:
root@***:/var/git/repositories# ls -l
drwxr-x--- 8 git git 4096 12. Okt 22:26 gitosis-admin.git
drwxr-x--- 7 git git 4096 12. Okt 22:36 test.git
cd test.git
root@***:/var/git/repositories/test.git# ls -l
drwxr-xr-x 2 git git 4096 12. Okt 22:36 branches
-rw-r--r-- 1 git git 66 12. Okt 22:36 config
-rw-r--r-- 1 git git 18 12. Okt 22:36 description
-rw-r--r-- 1 git git 23 12. Okt 22:36 HEAD
drwxr-xr-x 2 git git 4096 12. Okt 22:36 hooks
drwxr-xr-x 2 git git 4096 12. Okt 22:36 info
drwxr-xr-x 4 git git 4096 12. Okt 22:36 objects
drwxr-xr-x 4 git git 4096 12. Okt 22:36 refs
Users and Groups are always git:git. Any idea? Is it that I have to add the www-data user? I am not a very experienced Ubuntu user, but I keep trying.
EDIT: I made a chmod 777
onto description and now it works fine. Is that the way to go?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Web 服务器无权进入存储库目录。给予“其他人”对 test.git 的读取和执行权限也可以解决问题,所以:
应该完成这项工作。设置 777 还向每个人授予写入权限,这在 Web 服务器或任何与此相关的服务器上通常是一个坏主意。
The web server has no rights to enter the repo directories. Giving the "others" the read and execute rights on test.git will also solve the problem, so:
should do the job. Setting 777 also gives write rights to everybody which is generally a bad idea on a web server, or any server for that matter.