Skip to content

Reads the username and email from `.gitconfig` and returns it as json object

License

Notifications You must be signed in to change notification settings

rocktimsaikia/read-git-user

Repository files navigation

read-git-user build

Reads the Github username and email from .gitconfig 🔧 and returns it as a json object

Highlights

  • Tiny(1.3kB ✨) and simple
  • Returns the original github-username since the stored git name can be altered and not reliable.
  • Uses Ini to handle the parsing of the ini config file

Install

npm install read-git-user

Usage

import readGitUser = require('read-git-user');

(async () => {
        const gitUser = await readGitUser();
        //=> {username: RocktimsSaikia, email: [email protected]}
})();

API

readGitUser(options?)

Returns a Promise<object> with the parsed JSON.

options

dir

Type: string
Default: os.homedir()

The directory of the .gitconfig file

License

MIT © Rocktim Saikia

About

Reads the username and email from `.gitconfig` and returns it as json object

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project