Git post-receive hook stopped copying files to web directory

132 views Asked by At

Disclaimer: I'm a git newbie.

I followed the following post: Setting up your git repos the normal way (here on stackoverflow) to get a --bare repo set up at /home/www-data/themename.git and a post-receive hook working that copied everything to my /var/www/domain.com/htdocs/wp-content/themes/themename/ folder. (I followed the instructions on that post exactly). Everything was working perfectly.

However, today I wanted to take a look inside that post-receive hook and ran cat /home/www-data/themename.git/hooks/post-receive. If you didn't notice, I accidentally placed two spaces after cat instead of one. Which overwrote everything in the file rather than displaying it. Looking back, I should have just used nano. So I opened the post again, and copied the code snipped from the post and pasted it into my post-receive hook again. But now it doesn't do anything. The files aren't copied.

Thinking that maybe it was a permissions issue, I ran chown -R www-data:www-data on /var/www and that didn't work. I also ran chown -R www-data:www-data on /home/www-data and that also didn't work. Lastly I ran chmod +x /home/www-data/themename.git/hooks/post-receive to make the file executable in case it stopped being, and that also doesn't work.

Also, git pull still works correctly in the /var/www/domain.com/htdocs/wp-content/themes/themename/ directory.

Any suggestions to fix this? Or should I just create the repos and directories from scratch again?

1

There are 1 answers

0
Adriano C R On BEST ANSWER

This started working again after the server was rebooted.