设定Git仓库的钩子 一般路径为 xxx.git/hooks 参考文档 https://git-scm.com/docs/githooks
修改 post-receive
#!/bin/bash
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "developer" == $branch ]; then
echo 'start call jenkins'
curl -s --user jenkins用户名:jenkins密码 JenkinsJObURL
echo 'end call jenkins'
fi
done