# github-username

> Get a GitHub username from an email address

Latest version **9.0.0** (published 2025-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install github-username
pnpm add github-username
yarn add github-username
bun add github-username
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 9.0.0 |
| Published | 2025-02-20 |
| First published | 2014-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 127 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | github, user, username, email, address, gh, git |

## Links

- npm: https://www.npmjs.com/package/github-username
- Repository: https://github.com/sindresorhus/github-username
- Homepage: https://github.com/sindresorhus/github-username#readme
- Issues: https://github.com/sindresorhus/github-username/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/github-username

## Dependencies (1)

- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^21.1.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 9.0.0 (latest) — 2025-02-20
- 8.0.0 — 2023-08-05
- 7.0.0 — 2021-10-14
- 6.0.0 — 2020-12-23
- 5.0.1 — 2019-06-02
- 5.0.0 — 2019-04-15
- 4.1.0 — 2017-07-01
- 4.0.0 — 2017-04-01
- 3.0.0 — 2016-08-14
- 2.1.0 — 2015-11-14
- 2.0.0 — 2015-05-06
- 1.1.1 — 2015-01-11
- 1.1.0 — 2015-01-11
- 1.0.0 — 2014-08-14
- 0.1.1 — 2014-03-26
- … 1 more at https://npm.io/package/github-username/versions

## README

# github-username

> Get a GitHub username from an email address

## Install

```sh
npm install github-username
```

## Usage

```js
import githubUsername from 'github-username';

console.log(await githubUsername('sindresorhus@gmail.com'));
//=> 'sindresorhus'
```

## API

### githubUsername(email, options?)

Get the GitHub username from an email address if the email can be found in any commits on GitHub.

Returns a `Promise<string?>` with the username.

#### email

Type: `string`

The email address for the user of whom you want the username.

#### options

Type: `object`

##### token

Type: `string`

GitHub [personal access token](https://github.com/settings/tokens/new).

## Related

- [github-username-cli](https://github.com/sindresorhus/github-username-cli) - CLI for this module

---
_Source: https://npm.io/package/github-username · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
