Giter Site home page Giter Site logo

webhook's Introduction

git webhook

git的钩子实现 ##Configuration 修改config.php

$_config_data["test"]  每一组都是一个站点,你可以多加几个站点
比如
$_config_data["new"] = array();
 $_config_data["new"]["access_token"] = "secret-token";//密钥
 $_config_data["new"]["access_ip"] = array("192.168.2.18");//允许ip
 $_config_data["new"]["dir"] = "/home/wwwys/test/webhook/";//目录必填
 $_config_data["new"]["git_url"] = "[email protected]:czw/test.git";//git地址
 $_config_data["new"]["sh_clone"] = "git clone {$_config_data["test"]["git_url"]} {$_config_data["test"]["dir"]}";//git clone 命令 初次发布必填
 $_config_data["new"]["sh_pull"] = "cd {$_config_data["test"]["dir"]} && /usr/bin/git pull"; //git pull 命令 更新代码必填

###web server open_basedir路径相对于需要发布的项目路径更高一级,不然php无法判断跨范围文件是否存在

##On GitHub | GitLab | Bitbucket

GitHub

In your repository, navigate to Settings → Webhooks → Add webhook, and use the following settings:

  • Payload URL: https://www.yoursite.com/webhook/index.php?k=new
  • k 参数是你配置的数组key值
  • Content type: application/json
  • Secret: The value of TOKEN in config.php
  • Which events would you like to trigger this webhook?: 🔘 Just the push event
  • Active: ☑️

Click "Add webhook" to save your settings, and the script should start working.

Example screenshot showing GitHub webhook settings

GitLab

In your repository, navigate to Settings → Integrations, and use the following settings:

Click "Add webhook" to save your settings, and the script should start working.

Example screenshot showing GitLab webhook settings

Bitbucket

In your repository, navigate to Settings → Webhooks → Add webhook, and use the following settings:

Click "Save" to save your settings, and the script should start working.

Example screenshot showing Bitbucket webhook settings

webhook's People

Contributors

nbczw8750 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.