Giter Club home page Giter Club logo

gitane's Introduction

Gitane

Gitane bicycle

Build Status

Easy Node.JS Git wrapper with support for SSH keys. By default, the Git CLI tool will only use the SSH key of the current user (e.g. $HOME/.ssh/id_dsa).

In order to be able to use Git with an arbitrary SSH key, a wrapper shell script to invoke ssh -i <key> must be written and the GIT_SSH environment variable must point to that script.

Gitane wraps all this plumbing for you. Simply pass the SSH private key you wish to run Git with as a string argument and let Gitane do the rest. Gitane will clean up the temporary wrapper script after it is done.

Installation

Gitane is available in NPM. npm install gitane

Example

  var fs = require('fs')
  var gitane = require('gitane')
  var path = require('path')

  // Use current working dir
  var baseDir = process.cwd()
  // Read private key from ~/.ssh/id_dsa
  var privKey = fs.readFileSync(path.join(process.env.HOME, '.ssh/id_dsa'), 'utf8')

  gitane.run(baseDir, privKey, "git clone git://github.com/niallo/Gitane.git",
    function(err, stdout, stderr, exitCode) {
    if (err) {
      console.log("An error occurred: " + stderr)
      process.exit(1)
    }

    console.log("Git clone complete!")
  })

Tests

Gitane comes with tests. To run, simply execute npm test.

License

Gitane is released under a BSD license.

Credits

Picture of Gitane fixie CC-BY Herb Real from http://www.flickr.com/photos/herbrealphotography/3593701411/

gitane's People

Contributors

jaredly avatar jereynolds avatar niallo avatar oliversalzburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gitane's Issues

Windows Support: Process exited with status -4058

I'm seeing the error process exited with status -4058 when trying to run a sample app and/or the mocha tests. Saw a couple commits in the project history about adding Windows support so I assumed that this project supports Windows, or am I just doing something funky?

$ mocha
child_process: customFds option is deprecated, use stdio instead.


  gitane
    #run
      1) should run the command with correct GIT_SSH environment
      2) should run the command in the correct baseDir
      √ should correctly handle failed commands
    #writeFiles
      √ should create a random file if none specified
      √ should use passed-in file if specified
      3) should create an executable script and an 0600-mode key by default
      4) should create an executable script and honour keyMode param
      5) should support event emitter parameter for real-time updates


  3 passing (62ms)
  5 failing

  1) gitane #run should run the command with correct GIT_SSH environment:
     Uncaught AssertionError: expected 'process exited with status -4058' to be null


  2) gitane #run should run the command in the correct baseDir:
     Uncaught AssertionError: expected 'process exited with status -4058' to be null


  3) gitane #writeFiles should create an executable script and an 0600-mode key by default:
     Uncaught AssertionError: expected '100666' to deeply equal '100755'


  4) gitane #writeFiles should create an executable script and honour keyMode param:
     Uncaught AssertionError: expected '100666' to deeply equal '100755'


  5) gitane #writeFiles should support event emitter parameter for real-time updates:
     Uncaught AssertionError: expected 'process exited with status -4058' to be null

My Setup:

  • Windows 8.1
  • Node v0.12

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.