• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

chriseldredge/git-slack-hook: Git receive hook to notify Slack channels

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

chriseldredge/git-slack-hook

开源软件地址:

https://github.com/chriseldredge/git-slack-hook

开源编程语言:

Shell 100.0%

开源软件介绍:

Git post-receive hook for Slack

This is a bash script that posts a message into your Slack channel when changes are pushed.

Hook this script into post-receive for your git repositories.

How to Install

Note: some git repositories may be "bare". You'll know if your repo is bare or not by checking for a .git folder where your repo lives.

Download git-slack-hook onto the server which hosts your git repo.

For bare repos, copy/rename it as /path/to/your/repo/hooks/post-receive.

For normal/non-bare repos, copy/rename it as /path/to/your/repo/.git/hooks/post-receive.

Finally, chmod +x post-receive to allow the script to be executed.

Configuration

Add an Incoming WebHooks integration in your Slack by going to:

https://my.slack.com/services/new/incoming-webhook

For a normal/non-bare repo, configure the webhook URL

git config hooks.slack.webhook-url 'https://hooks.slack.com/services/...'

For a bare repo:

git config -f /path/to/your/repo/config hooks.slack.webhook-url 'https://hooks.slack.com/services/...'

Optional

Specify a channel to post in Slack instead of the default:

git config hooks.slack.channel '#general'

    '#channelname' - post to channel
    '@username' - direct message to user
    'groupname' - post to group

Specify a username to post as. If not specified, the default name incoming-webhook will be used:

git config hooks.slack.username 'git'

Specify an icon to display in Slack instead of the default:

git config hooks.slack.icon-url 'https://example.com/icon.png'

Specify an emoji icon to display in Slack instead of the default:

git config hooks.slack.icon-emoji ':twisted_rightwards_arrows:'

Specify a repository nice name that will be shown in messages:

git config hooks.slack.repo-nice-name 'My Awesome Repository'

Specify whether you want to show only the last commit (or all) when pushing multiple commits:

git config hooks.slack.show-only-last-commit true

Specify whether you want to show the body of the commit message as well as the title:

git config hooks.slack.show-full-commit true

Specify if you want to send only certain branches:

git config hooks.slack.branch-regexp regexp

Linking to Changesets

When the following parameters are set, revision hashes will be turned into links to a web view of your repository.

git config hooks.slack.repos-root '/path/to/repos'
git config hooks.slack.changeset-url-pattern 'http://yourserver/%repo_path%/changeset/%rev_hash%'

For example, if your repository is in /usr/local/repos/myrepo, set repos_root to /usr/local/repos/ and set changeset_url_pattern to http://yourserver/%repo_path%/changeset/%rev_hash% or whatever.

Links can also be created that summarize a list of commits:

git config hooks.slack.compare-url-pattern 'http://yourserver/%repo_path%/compare/%old_rev_hash%..%new_rev_hash%'



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
NataliaLKB/learn-git-basics: A Beginner's Guide to Git发布时间:2022-06-11
下一篇:
jsomers/git-game: The git committer guessing game!发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap