Skip to content

Update the Git integration doc. #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 41 additions & 18 deletions zulip/integrations/git/doc.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,54 @@
Get Zulip notifications for your Git repositories!
# Zulip Git integration

1. {!create-an-incoming-webhook.md!}
Get Zulip notifications for pushes to your Git repositories!

1. {!download-python-bindings.md!}
Note that Zulip also offers integrations for [GitHub](./github),
[GitLab](./gitlab) and various other
[version control hosting services][other-integrations].

1. {!create-channel.md!}
{start_tabs}

1. {!change-zulip-config-file.md!}
1. {!create-an-incoming-webhook.md!}

You may also need to change the value of `STREAM_NAME`.
1. {!download-python-bindings.md!}

You can specify the branches that will be used for notifications by modifying
the `commit_notice_destination` function. By default,
pushes to the `main`, `master`, and `test-post-receive` branches will result in a
notification.
1. If your Git server and your Zulip server are on the same machine,
symlink the `post-receive` hook of your Git repository in your Git
server by running:

1. Symlink `/usr/local/share/zulip/integrations/git/zulip_git_config.py`
to the `.git/hooks` directory of your Git repository.
`ln -s {{ integration_path }}/post-receive your-repo.git/hooks/post-receive`

1. Symlink `/usr/local/share/zulip/integrations/git/post-receive`
to the `.git/hooks` directory of your Git repository.
Otherwise, copy the `post-receive` hook to your Git repository's
`/hooks` directory.

The `post-receive` hook is triggered on every push to the repository.

1. {!change-zulip-config-file.md!}

1. Copy the config file to the same directory as the `post-receive` hook.

`cp {{ config_file_path }} your-repo.git/hooks`

!!! tip ""

You can test the plugin without changing your `main` branch by
pushing to the `test-post-receive` branch.
Use the `test-post-receive` branch to test the integration without
modifying your `main` branch.

{end_tabs}

### Configuration options

In `{{ config_file_path }}`, you can set:

- The channel where notifications are sent by updating the value of
`STREAM_NAME`. By default, notifications are sent to a channel named
"commits".

- Which branches send notifications when pushed by updating the
`commit_notice_destination` function. By default, pushes to the `main`,
`master`, and `test-post-receive` branches will result in notifications.

{!congrats.md!}
- The message format used in your Zulip notifications by updating the
`format_commit_message` function.

![Git bot message](/static/images/integrations/git/001.png)
[other-integrations]: ../version-control
Loading