Coder Social home page Coder Social logo

forksss / node-git-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gabrielcsapo/node-git-server

0.0 2.0 0.0 988 KB

๐ŸŽก A configurable git server written in Node.js

Home Page: https://www.gabrielcsapo.com/node-git-server/

License: MIT License

JavaScript 100.00%

node-git-server's Introduction

node-git-server

๐ŸŽก A configurable git server written in Node.js

there be ๐Ÿฒ here! The API's and functionality are still be cemented, anything before a 1.0.0 release will be subject to change.

Npm Version Build Status Coverage Status Dependency Status devDependency Status npm npm

Install

npm install node-git-server

Usage

const path = require('path');
const Server = require('node-git-server');

const repos = new Server(path.resolve(__dirname, 'tmp'), {
    autoCreate: true,
    authenticate: (type, repo, user, next) => {
      if(type == 'push') {
        user((username, password) => {
          console.log(username, password);
          next();
        });
      } else {
        next();
      }
    }
});
const port = process.env.PORT || 7005;

repos.on('push', (push) => {
    console.log(`push ${push.repo}/${push.commit} (${push.branch})`);
    push.accept();
});

repos.on('fetch', (fetch) => {
    console.log(`fetch ${fetch.commit}`);
    fetch.accept();
});

repos.listen(port, () => {
    console.log(`node-git-server running at http://localhost:${port}`)
});

then start up the node-git-server server...

$ node example/index.js

meanwhile...

$ git push http://localhost:7005/beep master
Counting objects: 356, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (133/133), done.
Writing objects: 100% (356/356), 46.20 KiB, done.
Total 356 (delta 210), reused 355 (delta 210)
To http://localhost:7005/beep
 * [new branch]      master -> master

Example

Running the following command will start up a simple http server:

node example/index.js

If you want to try using https run the following

node example/index.js --https

When running https with self-signed certs there are two ways to override the git-clients behavior using git config http.sslVerify false or git config --global http.sslCAInfo /path/to/cert.pem

For more information please visit the docs

Philosophy

This library is aimed to have a zero dependency footprint. If you are reading this and you see dependencies, help to remove them ๐Ÿ’.

Thanks

This is a hard fork from pushover.

node-git-server's People

Contributors

gabrielcsapo avatar echopoint avatar jaywcjlove avatar kubenstein avatar hasezoey avatar

Watchers

James Cloos avatar  avatar

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.