post-receive hook permission denied “unable to create file” error

最后都变了- 提交于 2019-12-01 09:35:32

This is how I got it working:

Changed post-receive to:

sudo sh /usr/local/sbin/prgetsimpleappscom

Changed sudoers with visudo

git ALL = (root) NOPASSWD: /usr/local/sbin/prgetsimpleappscom
git ALL = (root) NOPASSWD: /bin/sh
git ALL = (root) NOPASSWD: /bin/sh /usr/local/sbin/prgetsimpleappscom

Confirm visudo worked

git@vannevar:~$ sudo -l
Matching Defaults entries for git on this host:
    env_reset, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User git may run the following commands on this host:
    (root) NOPASSWD: /usr/local/sbin/prgetsimpleappscom
    (root) NOPASSWD: /bin/sh
    (root) NOPASSWD: /bin/sh /usr/local/sbin/prgetsimpleappscom

run:

sudo sh /usr/local/sbin/prgetsimpleappscom
post-receive getsimpleapps.com triggered

and:

$ git push origin master
remote: post-receive getsimpleapps.com triggered
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!