zulip/templates/zerver/integrations/git.md

43 lines
1.5 KiB
Markdown
Raw Normal View History

{! download-python-bindings.md !}
Next, create the stream youd like to use for Git notifications, and
subscribe all interested parties to this stream. The integration will
use the default stream `commits` if no stream is supplied in the hook;
you still need to create the stream even if you are using this
default.
Next, open `integrations/git/zulip_git_config.py` in your favorite
editor, and change the following lines to specify the email address
and API key for your Git bot:
```
ZULIP_USER = "git-bot@example.com"
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
{% if api_site_required %}ZULIP_SITE = "{{ external_api_uri_subdomain }}"{% endif %}
```
You can also specify which pushes will result in notifications and to
what stream the notifications will be sent by modifying the
`commit_notice_destination` function in `zulip_git_config.py`. By
default, pushes to the `master` and `test-post-receive` branches will
result in a notification to stream `commits`.
Save `integrations/git/zulip_git_config.py` to the `.git/hooks`
directory of your git repository.
Symlink `/usr/local/share/zulip/integrations/git/post-receive` into
the `.git/hooks` directory of your git repository.
Whenever you make a push to the `master` branch of your git repository
(or whatever you configured above), the Zulip git plugin will send an
automated notification.
{! congrats.md !}
![](/static/images/integrations/git/001.png)
**Testing**
You can test the plugin without changing your `master` branch by
pushing to the `test-post-receive` branch.