GIT-Push Server
This node module makes it easy to build an HTTP stateless git-push server, to build stuff like Heroku or GitBook.io without keeping the repositories content.
Installation
$ npm install git-push-server
Example
var GitPush = ;var express = ;var path = ; // Create the http applicationvar app = ; // Create the git-push servervar git = ; // Create a router for the git-push servervar router = express; // Start the git server on the routergitstartrouter; // Bind the router to the appapp;app; // Start the http servervar server = app;
You can now run from a git repository:
$ git push http://localhost:3000/test/test.git master
Run an operation on each push
If you need to run an operation on the folder resulting from the push, you need to override push
. For async operaiton, this method can return a promise.
git { // pushInfos.repoId // pushInfos.auth.username // pushInfos.auth.password // pushInfos.content // pushInfos.bare // do some build or deployment operation};
Authentication
You need to override authenticate
to make authentication work. It should return a boolean or a promise for async authentication.
git { // infos.repoId -> repository id set with in req.repoID // infos.username // infos.password return ;};
Options
var git = options;
options.debug
: enable log messages (default false)
options.root
: root directory for the repositories (default os.tmpdir)