read-git-user
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

read-git-user

Returns the GitHub username and email of the current system's .gitconfig.

[!NOTE] This function retrieves the original GitHub username since the stored
git config name is not reliable. The local name can be changed without
affecting any Git or GitHub activities as long as the email matches any
verified emails on the GitHub account.

Tests npm

Install

npm i read-git-user

Usage

import readGitUser from "read-git-user";

const gitUser = await readGitUser();

console.log(gitUser);
// => {username: rocktimssaikia, email: rocktimthedev@gmail.com}

API

readGitUser(options)

Returns a Promise<object> with the retrieved git config data.

Options (object) :

dir

Type: string
Default: os.homedir()

The directory of the .gitconfig file.
This option is available in-case the config file is not in the default dir for some systems.

Package Sidebar

Install

npm i read-git-user

Weekly Downloads

5

Version

3.0.0

License

MIT

Unpacked Size

4.33 kB

Total Files

5

Last publish

Collaborators

  • rocktimsaikia