Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A simple way to extract out all the contents of a .gitconfig file and return as JSON

branch: master

0.0.6

latest commit 9b4e236547
Eugene Ware authored February 26, 2014
Octocat-spinner-32 test add test for origin url February 26, 2014
Octocat-spinner-32 .gitignore Initial commit September 11, 2013
Octocat-spinner-32 .jshintrc Initial commit September 11, 2013
Octocat-spinner-32 .travis.yml Initial commit September 11, 2013
Octocat-spinner-32 Gruntfile.js Initial commit September 11, 2013
Octocat-spinner-32 LICENSE add LICENSE September 11, 2013
Octocat-spinner-32 README.md Update README September 11, 2013
Octocat-spinner-32 index.js actually check that this fixes the problem February 26, 2014
Octocat-spinner-32 package.json 0.0.6 February 26, 2014
README.md

git-config

A simple way to extract out all the contents of a .gitconfig file and return as JSON

build status

Installation

This module is installed via npm:

$ npm install git-config

Example Usage

Asynchronous

var gitConfig = require('git-config');
gitConfig(function (err, config) {
  if (err) return done(err);
  expect(config.user.name).to.equal('Eugene Ware');
  expect(config.user.email).to.equal('eugene@noblesamurai.com');
  expect(config.github.user).to.equal('eugeneware');
  done();
});

Explicitly give a gitconfig file:

var gitConfig = require('git-config');
gitConfig('/my/path/.gitconfig1', function (err, config) {
  if (err) return done(err);
  expect(config.user.name).to.equal('Eugene Ware');
  expect(config.user.email).to.equal('eugene@noblesamurai.com');
  expect(config.github.user).to.equal('eugeneware');
  done();
});

Synchronous

var gitConfig = require('git-config');
var config = gitConfig.sync(); // can pass explit file if you want as well
Something went wrong with that request. Please try again.