Giter Club home page Giter Club logo

gitty's Introduction

Gitty

Build Status

Gitty is a Node.js wrapper for Git. It's syntax resembles the Git command line syntax, executes common commands, and parses the output into operable objects.

Installation

Prerequisites

$ npm install gitty

Note: If you encounter an error during installation on Mac OSX, make sure you have the XCode Command Line Tools installed. Gitty depends on pty.js for authenticated operations - which requires GCC compiler.

  1. Go to the App store and download the latest version of Xcode for free.
  2. Install Xcode (the app store actually downloads the "installer" for Xcode)
  3. Start Xcode
  4. Go to Preferences
  5. Go to Downloads
  6. Click on the "install" button after "Command Line Tools"
  7. Reboot

Testing

Run the the unit and integration tests with:

$ npm test

Usage

var git    = require('gitty');
var myRepo = git('/path/to/repo');

Now you can call this instance of Repository's methods. For example, to execute git log for myRepo, you would do:

myRepo.log(function(err, log) {
	if (err) return console.log('Error:', err);
	// ...
});

Where are the Docs?

For now, use the source, Luke. Pretty much everything you'll need is in lib/repository.js and it's very readable. Running the test suite will be of use as well since all public methods are tested and will print to the console.

Authenticated Repositories

Since OpenSSH does not read input from stdin for authentication, but rather a psuedo-terminal - Gitty uses pty.js (https://github.com/chjj/pty.js/) to spawn a pseudo-terminal for operations that may require authentication, such as pull, push, and clone.

Credentials are always passed as the last argument before the callback and are optional. Below is an example of an authenticated Repository.push().

myRepo.push('origin', 'master', {
	username: 'username',
	password: 'password'
}, function(err, succ) {
	if (err) return console.log(err);
	// ...
});

This format is consistent for all authenticated operations. Keep this in mind if you are extending Gitty with an operation that requires authentication, and be sure to read the pty.js documentation.

Author

Gitty was written by Gordon Hall ([email protected])
Licensed under LGPLv3 license

gitty's People

Contributors

jas avatar jwcooper avatar martindale avatar meysolution avatar naholyr avatar samccone avatar tomruggs avatar

Watchers

 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.