Giter VIP home page Giter VIP logo

gitdub's Introduction

gitdub

gitdub is a github web-hook that converts a changeset pushed into one email per change via git-notifier. Unlike the existing github email hook, gitdub sends out detailed diffs for each change.

Setup

Dependencies

  • git (>= 1.7.12)
  • Ruby (>= v1.9)
  • gem install sinatra
  • git-notifier (master branch required)

Installation

  1. cp gitdub /path/to/dir/in/$PATH
  2. cp config.yml.example config.yml
  3. gitdub config.yml

Integration with github

  1. Navigate to a repository you own, e.g., https://github.com/user/repo
  2. Click on Settings on the top-right corner
  3. Click on Service Hooks in the left sidebar
  4. Select the first service WebHook URLs
  5. Enter the URL to reach gitdub, e.g., http://gitdub.mydomain.com:8888/, and choose x-www-form-urlencoded requests.
  6. Click Update Settings to save your changes
  7. Click again on WebHook URLs
  8. Click Test Hook to let github initialize your repository

Customizing

The YAML configuration file contains the list of repositories that gitdub tracks. The first section (gitdub:) specifies global options, such as the interfaces gitdub should bind to and ports to listen on. Moreover, you can control the behavior of the first chunk of data. When setting silent_init: to true, gitdub will only fast-forward to the current commit and begin mailing diffs after the next push (or after hitting the Test Hook button). Otherwise gitdub sends exactly one email per commit since the first commit in the repository.

The second section (notifier:) describes the behavior of git-notifier. Here you can the configure a global sender of the emails (from:), the receivers (to:), and the prefix of the email subject (subject:).

The third section (github:) contains a list of github repository entries, where each entry must at least contain an id field. If an item does not contain any further options, the globals from the notifier section apply. However, in most cases it makes sense to override the globals with repository-specific information, e.g.:

notifier:
  # The email sender. (Can be overriden for each repository.)
  from: 'Sam Sender <[email protected]>'

  # The email subject prefix. (Can be overriden for each repository.)
  subject: '[git]'

github:
  - id: mavam/gitdub
    subject: '[git/gitdub]'    # Overrides global '[git]' subject prefix.
    from: [email protected]   # Overrides global sender.
    to: [[email protected]]   # Overrides global receivers.

  - id: mavam/.*
    from: mavam                # Overrides global sender.

Note the regular expression in the second entry. This enables the configuration of entire sets of repositories. Since gitdub processes the list sequentially in order of definition, only settings from the first match apply. For example, appending an entry for mavam/foo would never match.

Restricting Access

To prevent unauthorized access to the service, you can restrict the set of allowed source IP addresses to github addresses, e.g., via iptables:

iptables -A INPUT -m state --state NEW -m tcp -p tcp \
    -s 207.97.227.253,50.57.128.197,108.171.174.178 --dport 42042 -j ACCEPT

If that's not an option on your machine, you can also perform application-layer filtering in gitdub by setting the following configuration option:

allowed_sources: [207.97.227.253, 50.57.128.197, 108.171.174.178]

Licence

Gitdub comes with a BSD license, please see COPYING for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.