goenitz / githooks
非常简单的由PHP实现的git钩子
dev-master
2019-01-04 08:35 UTC
Requires
- illuminate/support: ^5.7
- nikic/fast-route: ^1.3
- symfony/var-dumper: ^4.2
This package is not auto-updated.
Last update: 2020-08-05 10:34:55 UTC
README
配置www-data用户
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
安装
composer create-project goentiz/githooks
编辑config.php,设置路径和命令。需要设置的路径为git服务器路径,例如http://www.xxx.com/path
'path' => [
'exec' => 'cd /var/www/platform-web && git pull && yarn && yarn run build',
],
就这样。
很简单,没有进行验证。您可以在index.php中添加验证或其他逻辑代码。