Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 3 commits ahead of Humbedooh:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


GitPubSub Publisher/Subscriber service for JSON based communication, developed for broadcasting git commits.

Changes to git repositories are transmitted in JSON format to anyone listening in on the HTTP service.

Pub/Sub model

GitPubSub broadcasts based on the URI requested. If a client subscribes to /foo, then all messages sent to /foo or its sub-directories (such as /foo/bar) will be broadcast to this client. This enables clients to subscribe to whichever specific segment they wish to listen in on.

Publishing data to GitPubSub

To send data through gitpubsub, add a post-receive hook to your Git server. Simply use the following script (edit it to fit your server):

while read oldrev newrev refname
   /usr/bin/lua /path/to/post_receive.lua $oldrev $newrev $refname

This will cause new commits to publish to http://localhost:2069/json by default. Or you can use the python version instead.

Manually publishing JSON data

GitPubSub offers any client matching the trustedPeers list to publicise data to all other clients. This is done by doing a POST request to the URI they wish to publish to:

POST /json HTTP/1.1
Content-Length: 1234


Pulling data off GitPubSub

Self-explanatory. Once you've set up GitPubSub, try running curl -i http://yourhost:2069/json and watch the output.

Retrieving past commits

While the Pub/Sub model usually deals with real-time events, it is possible to go back in time and retrieve past events using the X-Fetch-Since request header. This value must be set to the UTC UNIX timestamp of the last time a client visited the Pub/Sub service, in order to continue where it left off. For example, one could construct the following request:

GET /json HTTP/1.1
X-Fetch-Since: 1366268954

These timestamps can be acquired by parsing the stillalive messages sent by GitPubSub, using the X-Timestamp response header sent back from POST/PUT requests, or by using whatever time function your programming language provides.

Access control:

The trustedPeers array contains a list of clients allowed to publish to the GitPubSub server. By default, only is allowed to publish.

Any client can grab the JSON feeds off the server.



Best way to install gitpubsub is using luarocks for dependencies. On debian, luarocks can be install with apt:

$ apt install luarocks

Install dependencies:

$ luarocks install luasocket luajson luafilesystem penlight

For python hook, you need to install httplib2:

$ apt install python-httplib2


If you want to use gitpubsub with systemd, create a file like /etc/systemd/system/gitpubsub-server.service:

Description=Gitpubsub server

ExecStart=/usr/bin/lua gitpubsub.lua


Verify access right for user and do not forget to reload systemd with systemctl daemon-reload.

Git hook

Move or link script to git hooks directory.

Polling for statistics

If your IP is within the trustedPeers list, you can poll the server for statistics by running: curl -I http://localhost:2069. This will output something similar to:

Server: GitPubSub/0.4
X-Uptime: 200
X-Connections: 1
X-Total-Connections: 39017
X-Received: 584421
X-Sent: 1563105

Other uses

GitPubSub can be used to broadcast any form of JSON-encoded data to multiple recipients, not just Git commits.


A subscribable Git commit notification server written in Lua.







No releases published


No packages published


  • Lua 84.9%
  • Python 11.9%
  • Shell 3.2%