简体   繁体   English

如何在 Git 推送上接收 webhook?

[英]How can I receive a webhook on a Git push?

How can I automatically create a Git repository then when a commit is pushed to it send a POST request with a blob to http://example.com/webhook ?我如何自动创建一个 Git 存储库,然后在向它推送提交时将带有 blob 的 POST 请求发送到http://example.com/webhook

The objective of this is to create a online service that works like Dokku.这样做的目的是创建一个像 Dokku 一样工作的在线服务。

This can be done by creating a Git hook , in particular a post-receive hook .这可以通过创建一个Git hook来完成,特别是一个post-receive hook

If you want to wait for http://example.com/webhook to respond to the POST (good luck, with that URL) and only accept the push based on what it says, you'll need to use a pre-receive hook instead.如果您想等待http://example.com/webhook响应 POST(祝您好运,使用该 URL)并且仅根据其内容接受推送,则需要使用 pre-receive hook反而。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM