Extract the username from a git remote origin URL.
Installations
npm install git-username
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=0.8
Node Version
9.7.1
NPM Version
5.6.0
Score
97.9
Supply Chain
97.7
Quality
74.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
12,291,494
Last Day
2,543
Last Week
50,993
Last Month
257,175
Last Year
3,786,458
GitHub Statistics
MIT License
17 Stars
29 Commits
3 Forks
3 Watchers
1 Branches
4 Contributors
Updated on Sep 17, 2024
Bundle Size
7.93 kB
Minified
3.05 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
git-username@1.0.0
Size
3.21 kB
NPM Version
5.6.0
Node Version
9.7.1
Published on
Mar 03, 2018
Total Downloads
Cumulative downloads
Total Downloads
12,291,494
Last Day
-56.9%
2,543
Compared to previous day
Last Week
-23.6%
50,993
Compared to previous week
Last Month
-6.4%
257,175
Compared to previous month
Last Year
28.9%
3,786,458
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
2
git-username

Get the username (or 'owner' name) from a git/GitHub remote origin URL.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install
Install with npm:
1$ npm install --save git-username
Usage
If no arguments are passed, the .git/config
in the current working directory is used.
1var username = require('git-username'); 2console.log(username()); //=> jonschlinkert
Options
options.cwd
Type: string
Default: process.cwd()
Set the current working directory (cwd):
Examples
1username({ cwd: 'some/path' }); 2 3// cwd may also be passed as the first argument 4username('some/path');
options.strict
Type: boolean
Default: undefined
Throw an error when a git config or git remote origin cannot be resolved. Otherwise, when strict
is not true and a remote origin cannot be resolved, null
is returned.
Example
1username({ strict: true });
Release history
v1.0
Breaking changes
- The second argument can no longer be a boolean (for warning when git remote origin is not found). Use options.strict instead.
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Related projects
You might also be interested in these projects:
- git-branch: Get the current branch for a local git repository. | homepage
- git-user-name: Get a user's name from git config at the project or global scope, depending on… more | homepage
- parse-git-config: Parse
.git/config
into a JavaScript object. sync or async. | homepage - remote-origin-url: Get the git remote origin URL from your local git repository. Remember! A remote origin… more | homepage
Contributors
Commits | Contributor |
---|---|
21 | jonschlinkert |
1 | davisjam |
1 | jamo |
Author
Jon Schlinkert
License
Copyright © 2018, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on March 02, 2018.

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More