rocktimsaikia / read-git-user
Returns the GitHub username and email of the current system's .gitconfig
Read-git-user is a tiny 1.3kB✨ module that can be used to retrieve the git username and email right from the systems global .gitconfig
file.
How this works is that the module looks for HOME || USERPROFILE
and reads the ini
file from there and returns it as a parsed JSON object.
Usage
import readGitUser = require('read-git-user');
(async () => {
const gitUser = await readGitUser();
//=> {user: rocktimsaikia, email: rocktimsaikia@gmail.com}
const gitUser = readGitUser.sync()
//=> {user: rocktimsaikia, email: rocktimsaikia@gmail.com}
})();
[ PS: I created this tool to use it in a project that I am working on. I thought someone might find it handy so made a quick post. Leave a star at the repo 🌟 if find this helpful. Thanks for reading 👋]
Top comments (0)