开发者

GIT_WORK_TREE not only updating 1 file

开发者 https://www.devze.com 2023-04-12 15:49 出处:网络
I have set up a two bare git repository\'s on my server wi开发者_如何学JAVAth file paths like so:

I have set up a two bare git repository's on my server wi开发者_如何学JAVAth file paths like so:

/git/project.git/

/git/project2.git/

I then have added two branches dev and live. I then added the following post-receive hook to each project

`    
#!/bin/sh
while read oldrev newrev refname
 do
  echo "STARTING [$oldrev $newrev $refname]"
   if [ "$refname" == 'refs/heads/dev' ]
    then
     GIT_WORK_TREE=/var/www/vhosts/devwebsite.com/httpdocs/ git checkout -f
   elif [ "$refname" == 'refs/heads/live' ]
    then
     GIT_WORK_TREE=/var/www/vhosts/livewebsite.com/httpdocs/ git checkout -f
    fi
  done`

This works on 1 project but not the other. On the second project it only seems to work with my first file I pushed which happens to be a .gitignore file.

So in short this file is the only file that will be updated when I push.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号