https://github.com/rocktimsaikia/read-git-user
Returns the GitHub username and email of the current system's .gitconfig
https://github.com/rocktimsaikia/read-git-user
gitconfig github github-user
Last synced: 5 months ago
JSON representation
Returns the GitHub username and email of the current system's .gitconfig
- Host: GitHub
- URL: https://github.com/rocktimsaikia/read-git-user
- Owner: rocktimsaikia
- License: mit
- Created: 2020-10-11T11:36:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-31T20:15:59.000Z (about 1 year ago)
- Last Synced: 2025-05-11T03:59:34.251Z (5 months ago)
- Topics: gitconfig, github, github-user
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# 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.[](https://github.com/rocktimsaikia/read-git-user/actions/workflows/main.yml) [](https://npmjs.com/package/read-git-user)
## Install
```bash
npm i read-git-user
```## Usage
```js
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` 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.