amazon ec2 - why doesn't my git post-receive hook seem to work -
i have amazon ec2 instance that's running linux , has git installed. setup git repo following command.
git init --bare
i cd hooks directory , created post-receive file has following bash script.
#!/bin/sh git_work_tree=/var/www/mysite export git_work_tree git checkout -f
when push local repo server seems go well. tested adding new file called myfile.html project , pushing server. don't errors. however, when cd /var/www/mysite directory don't see new file added, if clone remote repo new directory locally changes pushed server.
my thought changes being tracked git fine when post-receive runs maybe sort of permissions issue keeping files getting moved , applied /var/www/mysite directory ?
hoping can shed light on may happening , how trouble shoot this.
========================================
so post-receive file needed following permissions set make executable.
chmod +x post-receive
after doing have actual permissions issue i'm telling git move files when pushed , post-receive runs.
my guess post-receive trying move files /var/www/mysite folder i'm asking gives me access denied errors when trying move , change files.
i tried adding sudo post-receive script so
#!/bin/sh sudo git_work_tree=/var/www/mysite export git_work_tree sudo git checkout -f
doing gave me following error when pushed code.
remote: usage: sudo [-d level] -h | -k | -k | -v remote: usage: sudo -v [-akns] [-d level] [-g groupname|#gid] [-p prompt] [-u user remote: name|#uid] remote: usage: sudo -l[l] [-akns] [-d level] [-g groupname|#gid] [-p prompt] [-u user remote: name] [-u user name|#uid] [-g groupname|#gid] [command] remote: usage: sudo [-abehknps] [-r role] [-t type] [-c fd] [-d level] [-g remote: groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] remote: [var=value] [-i|-s] [<command>] remote: usage: sudo -e [-akns] [-r role] [-t type] [-c fd] [-d level] [-g remote: groupname|#gid] [-p prompt] [-u user name|#uid] file ... remote: fatal: operation must run in work tree
Comments
Post a Comment