The principle of
When the local Git push Origin master submits the code to Github remote repository, Github webhook can be configured to send the request to the server, and Github – Webhook tool can be used to call the custom shell script to realize automatic construction after receiving the request on the server
Lot – webhook document
- More detailed documentation github.com/yezihack/gi…
Use the lot – webhook
Source: github.com/yezihack/gi… Don’t forget to light a little star.
1. Download github- Webhook
Github.com/yezihack/gi…
Github release download is too slow, try this one
Wget HTTP: / / http://img.sgfoot.com/github-webhook1.4.1.linux-amd64.tar.gzCopy the code
2. Making – webhook operation
The installation
Gz cp github-webhook /usr/bin/chmod u+x /usr/bin/github-webhookCopy the code
run
- Default port: 2020
- Valid address: http://ip:2020/web-hook
-b
Is the shell script path parameter-s
Is the password set by Github Webhook
No background runningGithub -webhook -b [shell script path]-s[Github webhook password]# background runNohup github-webhook -b [shell script path]-s[Github webhook password] &# Directed log output
nohup github-webhook -b ~/sh/hugo2www.sh -s qweqwe >> ~/logs/webhook.log 2>&1 &
Copy the code
Configuration making webhook
- Fill in your server address, http://ip:2020/web-hook
- The password set must run with the server
github-webhook -s
The passwords are the same.
test
After git push, you can see what github is pushing
git push origin master
Copy the code