遵循以Web为中心的Git工作stream程中的指示,我在Web服务器上设置了一个主要和集线器存储库,然后将集线器克隆到我的机器上。
我开始testing提交,并在文档中推送更改的文件,并且更改将显示在Web服务器的根目录上。 但是,当我试图推送一个子目录中的文件,我rec'd以下消息:
remote: remote: **** Pulling changes into Prime [Hub's post-update hook] remote: remote: From /home/git/site_hub remote: * branch master -> FETCH_HEAD remote: error: unable to create file academy/testthegit2.html (Permission denied)
同样,web根目录没有权限问题,但是把一个文件放在一个子目录中,并抛出一个错误。
git用户在Apache组中,子目录是chmod 755。
这是枢纽的更新后:
#!/bin/sh echo echo "**** Pulling changes into Prime [Hub's post-update hook]" echo cd /usr/local/apache/htdocs || exit unset GIT_DIR git pull hub master exec git-update-server-info
和素数(文档根的)后更新:
#!/bin/sh echo echo "**** pushing changes to Hub [Prime's post-commit hook]" echo git push hub
重申一下,在root中工作,在subdir中失败。
感谢您的任何build议。
你需要添加一个包装来纠正你的post-update钩子的权限。 根据您的服务器设置如何,涉及不同的步骤。 我会描述我的用例,希望能够适应您的需求。
在我的服务器中,裸仓库(hub)由gitosis / gitolite / plain git用户使用git-shell进行pipe理。 $GITOSIS_HOME下的文件由gitosis:gitosis拥有,并且被掩盖077 。
为了正确拉取所做的更改,我需要添加一个对存储在/usr/local/bin中的帮助程序脚本的调用,以在prime / live存储库中recursion地设置owner,group,permissions和SELinux上下文。
顺便说一下,我还需要添加一行到我的sudoers(5)文件,以允许gitosis以!requiretty和NOPASSWD root身份运行脚本。