【问题标题】:post-receive /var/www/html denied后接收 /var/www/html 被拒绝
【发布时间】:2018-09-17 05:15:46
【问题描述】:

我的用户名(我们称之为 my_name)属于 Apache 组,该组是 var/www/html 目录、子目录和其中包含的文件的所有者。

在那个目录中我安装了 Wordpress。目录和文件权限设置为 0775(是的,我知道文件应该有 644,但现在这不是一个因素)。

好吧,我的用户名确实具有写入权限,因为我可以使用 SSH 终端或 WinSCP 创建和删除新文件或目录。

当我运行一个裸 git 存储库的 post-receive 挂钩时,无论是通过运行脚本还是通过从本地工作存储库推送更改,都会出现问题。
在任何情况下,由于权限被拒绝,post-receive 挂钩都不起作用。真的很奇怪,我不明白为什么。

你能帮帮我吗?

编辑: 这是ls -alrth ~/git/devsite.git/hooks 目录的输出:

-rwxrwxr-x 1 name apache  896 Apr  2 22:41 commit-msg.sample
-rwxrwxr-x 1 name apache  727 Apr  7 09:09 post-receive
-rwxrwxr-x 1 name apache  189 Apr  2 22:41 post-update.sample
-rwxrwxr-x 1 name apache  398 Apr  2 22:41 pre-applypatch.sample
-rwxrwxr-x 1 name apache 1704 Apr  2 22:41 pre-commit.sample
-rwxrwxr-x 1 name apache 1239 Apr  2 22:41 prepare-commit-msg.sample
-rw-rw-r-- 1 name apache 1348 Apr  2 22:41 pre-push.sample
-rwxrwxr-x 1 name apache 4951 Apr  2 22:41 pre-rebase.sample
-rwxrwxr-x 1 name apache 3611 Apr  2 22:41 update.sample

这是接收后脚本:

#!/bin/sh
TARGET=/var/www/html/wp-content
GIT_DIR=/home/name/git/devsite.git

#run 'post-receive' hook
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f

【问题讨论】:

    标签: wordpress git hook git-push git-post-receive


    【解决方案1】:

    之后再试一次

    cd /path/tp/bare/repo
    git config core.sharedRepository true
    

    我之前在“Permissions with Git Post-Receive”中提到过。

    在 OP 的实例中,post-receive 脚本未正确放置:它应该在 ~/git/devsite.git/hooks,而不是 ~/git/devsite.git

    【讨论】:

    • 不工作。 /var/www/html 拥有 apache:apache 作为所有者/组,post-receive bash 脚本已作为 my_username 运行,但它不起作用。难以置信!
    • @R99Photography 你能用ls -alrth /path/to/post-receive/parent/folder的输出编辑你的问题吗?
    • 你有你问过我的细节。晚上。
    • @R99Photography 我已经相应地编辑了答案。
    • Post-receive 已经在挂钩中。我不知道那是什么。但不是我要运行的脚本
    猜你喜欢
    • 2017-10-26
    • 2016-07-02
    • 2019-05-17
    • 1970-01-01
    • 2016-05-03
    • 2014-03-14
    • 2021-10-21
    • 2023-04-02
    • 1970-01-01
    相关资源
    最近更新 更多