Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitolite

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitolite

Interface to a gitolite backend system

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

gitolite Build Status

This is a Work-in-progress.

Node.js interface to a gitolite backend system, inspired by the ruby gem gitolite

This works by maintaining interal data structures to represent the gitoltie admin repository. It does not require you to relinquish external control over the repository as it will rebuild the data structures based upon the current state of the repository, the configuration files, and the user keys.

Features

  • Creation and management of Repositories, Users, Keys, and Groups
  • Fine control over permissions
  • Manage repo-level configuration
  • Custom commit messages to admin repo

Requirements

  • Working gitolite installation
  • Node version 0.4.1 or newer

Installation

npm install gitolite

Usage

Get the admin repo object

var gitolite = require('gitolite');
gitolite('/path/to/gitolite/repo', function (err, adminRepo) {
  if (err) throw err;
  // manage here
});

// Dump internal data structures and reload the repo
// This will call `git fetch origin master && git merge --no-commit origin/master`
adminRepo.reload(function (err, adminRepo) {
  if (err) throw err;
  // manage here
});

User/Key management

// Basic user addition with keys
var bobsLaptopSSHkey = 'ssh-rsa AAAAB3Nz...cPel5ufw== Bob@TAHOE';
var bobsDesktopSSHkey = 'ssh-rsa AAS1i5aV...Fg90SKJ4== Bob@NATOMA'
var bobsSSHkey = 'ssh-rsa AAAA53bd...uV36sBsm== Bob@SHASTA';

adminRepo.addUser('bob');
var bob = adminRepo.users['bob'];
bob.addKey('laptop', bobsLaptopSSHkey);   // creates 'keydir/laptop/bob.pub'
bob.addKey('desktop', bobsDesktopSSHkey);
bob.addKey(bobsSSHkey); // creates 'keydir/{ SHA1(bobsSSHkey) }/bob.pub'
bob.removeKey('laptop');

// Fluent interface
var alicesMacbookSSHkey = 'ssh-rsa AAAA7b4p...5iK2kFSD== Alice@OAKLAND';
var alice = adminRepo.addUser('alice');
alice.addKey('macbook', alicesMacbookSSHkey) // creates keydir/macbook/alice.pub
  .addKey('ubuntu', alicesUbuntuSSHkey)      // creates keydir/macbook/alice.pub
  .addKey('ubuntulaptop', alicesUbuntuLaptopSSHkey);

// View all keys a given user has
for (var label in alice.keys)
  console.log(label + ' => ' + alice.keys[label]); // macbook => ssh-rsa AAAA7b4p...5iK2kFSD== Alice@OAKLAND;

// Delete user
adminRepo.removeUser('alice');

// Please note that users who are created but who are not given SSH keys
// will NOT be added to the admin repository. This is a limitation of
// gitolite itself.
var carol = adminRepo.addUser('carol');
adminRepo.commit(function (err, adminRepo) {
  adminRepo.users['carol'] // does not exist
});

Group management

adminRepo.addGroup('@admins', [ 'alice', 'bob' ]);
var adminGroup = adminRepo.groups['@admins'];
adminGroup.add('dave');
adminGroup.remove('bob');
console.log(adminGroup.users.join(', ')); // alice, dave

// get group object from 'addGroup()'
var devs = adminRepo.addGroup('@devs', [ 'ryan', 'sally', 'thomas' ]);
console.log(devs.users.join(', ')); // alice, dave

Repo management

var fooRepo = adminRepo.addRepo('foo');

// Delete the repo
adminRepo.removeRepo('bar');

User/Group permissions

var fooRepo = adminRepo.repos['foo'];
fooRepo.addPermission('@admins', 'RW+');
fooRepo.addPermission('john', 'RW+');
fooRepo.addPermission('john', 'R', 'development');
fooRepo.addPermission('jane', '-');

// removes permission, DOES NOT deny access
fooRepo.removePermission('jane'); // partial match of line

Repo configuration

var fooRepo = adminRepo.repos['foo'];
fooRepo.addConfig('hook.foo', './runfoobar.sh');
fooRepo.removeConfig('hook.bar');
var hookFoobarValue = fooRepo.configs['hook.foo'];

// commit changes to repo and push
adminRepo.commit(function (err, adminRepo) {
  if (err) throw err;
  console.log('admin repo updated');
});

License

The MIT License (MIT)

Copyright (c) 2014 Sam Thompson contact@samt.us

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 28 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc