amazon web services - Remote website synchronized with git local branch -
in ec2 aws instance, have remote bare git repository created following:
@server:~$ mkdir -p /home/myuser/domain.git && chmod 770 /home/myuser/domain.git && cd /home/myuser/domain.git && git init --bare with post-receive hook:
@server:~$ nano hooks/post-receive the hook script is:
#!/bin/sh sudo git --work-tree=/var/www/domain --git-dir=/home/myuser/domain.git checkout -f it has permission execute:
@server:~$ chmod +x hooks/post-receive i work on local repo following:
@local:~$ git init git remote add server server:/home/myuser/domain.git git checkout -b www-dev git add . git commit -am "initial" however, when push changes:
@local:~$ git push server www-dev the hook fails:
remote: fatal: on branch yet born server:/home/myuser/domain.git 06709ae..d1d7ead www-dev -> www-dev and website not updated. why?
i suspect problem caused fact git checkout -f called root. root can write in /var/www/domain.
awkward solution, have make first push master branch:
@local:~$ git init git remote add server server:/home/myuser/domain.git git add . git commit -am "initial" git checkout -b www-dev git push server master after can checkout branch:
@local:~$ git checkout -b www-dev however there problem: deploys master branch. solution problem can found here.
Comments
Post a Comment