2020-10-30 17:08:52 -04:00
---
2021-01-19 13:11:04 -05:00
stage: Enablement
group: Distribution
2020-11-26 01:09:20 -05:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-10-30 17:08:52 -04:00
---
2021-01-28 01:08:59 -05:00
# Webhooks administration **(FREE SELF)**
2014-05-27 08:12:15 -04:00
2020-04-28 02:09:49 -04:00
GitLab provides Rake tasks for webhooks management.
Requests to the [local network by webhooks ](../security/webhooks.md ) can be allowed or blocked by an
administrator.
## Add a webhook to all projects
To add a webhook to all projects, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook"
2020-04-28 02:09:49 -04:00
2019-07-01 00:24:02 -04:00
# source installations
bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" RAILS_ENV=production
2019-06-30 23:36:23 -04:00
```
2013-06-05 10:32:22 -04:00
2020-04-28 02:09:49 -04:00
## Add a webhook to projects in a namespace
To add a webhook to all projects in a specific namespace, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
2020-04-28 02:09:49 -04:00
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=< namespace >
2019-07-01 00:24:02 -04:00
# source installations
2020-04-28 02:09:49 -04:00
bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=< namespace > RAILS_ENV=production
2019-06-30 23:36:23 -04:00
```
2013-06-05 10:32:22 -04:00
2020-04-28 02:09:49 -04:00
## Remove a webhook from projects
To remove a webhook from all projects, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook"
2020-04-28 02:09:49 -04:00
2019-07-01 00:24:02 -04:00
# source installations
bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" RAILS_ENV=production
2019-06-30 23:36:23 -04:00
```
2013-06-05 10:32:22 -04:00
2020-04-28 02:09:49 -04:00
## Remove a webhook from projects in a namespace
To remove a webhook from projects in a specific namespace, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
2020-04-28 02:09:49 -04:00
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=< namespace >
2019-07-01 00:24:02 -04:00
# source installations
2020-04-28 02:09:49 -04:00
bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=< namespace > RAILS_ENV=production
2019-06-30 23:36:23 -04:00
```
2013-06-05 10:32:22 -04:00
2020-04-28 02:09:49 -04:00
## List all webhooks
To list all webhooks, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:list
2020-04-28 02:09:49 -04:00
2019-07-01 00:24:02 -04:00
# source installations
bundle exec rake gitlab:web_hook:list RAILS_ENV=production
2019-06-30 23:36:23 -04:00
```
2013-06-05 10:32:22 -04:00
2020-04-28 02:09:49 -04:00
## List webhooks for projects in a namespace
To list all webhook for projects in a specified namespace, run:
2013-06-05 10:32:22 -04:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-01 00:24:02 -04:00
# omnibus-gitlab
2020-04-28 02:09:49 -04:00
sudo gitlab-rake gitlab:web_hook:list NAMESPACE=< namespace >
2019-07-01 00:24:02 -04:00
# source installations
2020-04-28 02:09:49 -04:00
bundle exec rake gitlab:web_hook:list NAMESPACE=< namespace > RAILS_ENV=production
2019-07-01 00:24:02 -04:00
```