Git推送到临时服务器 - 错误消息

时间:2015-10-09 20:28:25

标签: git hook githooks

我想通过post-receive hook从本地计算机推送到登台服务器。

我做了以下步骤:

远程计算机

  • mkdir /var/www/mfserver.git
  • git init --bare
  • mkdir /var/www/mfserver
  • sudo chmod -R ug+w /var/www/mfserver/.git
  • sudo chown -R root:root /var/www/mfserver/.git
  • git config core.sharedRepository group

本地计算机

  • git remote add staging user@serverip:/var/www/mfserver.git

当我这样做时:git push staging master我仍然得到错误:

Delta compression using up to 8 threads.
Compressing objects: 100% (182/182), done.
Writing objects: 100% (206/206), 55.54 KiB | 0 bytes/s, done.
Total 206 (delta 69), reused 0 (delta 0)
remote: fatal: Unable to create temporary file '/var/www/mfserver.git/./objects/pack/tmp_pack_XXXXXX': Permission denied
error: unpack failed: index-pack abnormal exit
To admin@SERVERIP:/var/www/mfserver.git
 ! [remote rejected] master -> master (unpacker error)

挂钩

#!/bin/bash
while read oldrev newrev ref
do
        if [[ $ref =- .*/master$ ]];
        then
                echo "Master ref received. Deploying master branch to Staging..."
                git --work-tree=/var/www/mfserver --git-dir=/var/www/mfserver.git checkout -f
        else
                echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed to the server."
        fi
done

这是我的git hook:post-receive

我不明白为什么错误会出现?

0 个答案:

没有答案