From ddb1b570d73dae5d8581b4112faa8104c4bf56ed Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:43:24 +0530 Subject: [PATCH] integration-docs: Update the Git integration doc. --- zulip/integrations/git/doc.md | 59 ++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/zulip/integrations/git/doc.md b/zulip/integrations/git/doc.md index ffd281f0a..d5b2f64ef 100644 --- a/zulip/integrations/git/doc.md +++ b/zulip/integrations/git/doc.md @@ -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