goenitz/githooks

very simple git hook by php

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Type:project

dev-master 2019-01-04 08:35 UTC

This package is not auto-updated.

Last update: 2020-08-05 10:34:55 UTC


README

Config www-data user

mkdir -p /var/www/.ssh
chown www-data:www-data /var/www/.ssh/ -R
sudo -u www-data ssh-keygen -t rsa -C "xxx@xxx.com"
# paste the public key to git server SSH keys
cat /var/www/.ssh/id_rsa.pub
# test
sudo -u www-data git pull origin master

# make www-data user can run git command
vim /etc/sudoers

# Defaults:git    !authenticate #I don't add this line, but someone need
git ALL=(www-data) ALL

Install

composer create-project goentiz/githooks

Edit the config.php, set path and command. The path you need to set to git server. like http://www.xxx.com/path

    'path' => [
        'exec' => 'cd /var/www/platform-web && git pull && yarn && yarn run build',
    ],

That's all.

It's simple and don't have any validation. you can add validations or other logic codes in index.php