Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 1.1 KB

README.md

File metadata and controls

27 lines (20 loc) · 1.1 KB

gitlab-php-hook

PHP Hook for pulling new git commits from server

You need to update the configuration variables in githook.php to fit your system.
Your key is set in githook.php
Usage: http://example.com/githook.php?key={your_key}

If you want to do a hard reset before pulling, you should append &ignore=1 to the hook url.
For example: http://example.com/githook.php?key={your_key}&ignore=1

You need to have an SSH key for the user apache runs on, which in my case is www-data. I used this method to make it work: Create ssh folder (www-data has /var/www as home directory) sudo -u www-data mkdir -p /var/www/.ssh/ Create SSH key sudo -u www-data ssh-keygen -t rsa

Then you need to add the public key generated by that command (/var/www/.ssh/id_rsa.pub) to either your account on the gitlab server or to the deploy keys for your projects

I made the first pull of the project to my server using sudo -u www-data git clone git@github.com:exampleuser/example.git This prompted me to add that host to known_hosts.

After these steps everything should work.