gitauth-cli
v0.0.3
Published
A CLI to make it easier to change git configs using the GitHub CLI
Readme
gitauth-cli
A CLI to make it easier to change git configs using the GitHub CLI. This tool allows you to quickly switch between different GitHub accounts and automatically update your local git configuration to match.
Prerequisites
- Node.js
- GitHub CLI
- You must be logged into your desired GitHub accounts using
gh auth login.
Installation
npm install -g gitauth-cliCommands
The base command for this tool is gitauth.
use <username>
Switches the active GitHub CLI user and updates the global git user.name and user.email to match. If it's the first time you're using this account with gitauth-cli, it will prompt you to enter the associated email address, which it will then store for future use.
Usage:
gitauth use <username>Example:
gitauth use my-work-accountstatus
Displays the currently active GitHub CLI user, as well as the global user.name and user.email from your git configuration.
Usage:
gitauth statusupdate <username>
Updates the email address stored for a specific user. If the user being updated is the currently active git user, it will also ask if you want to update your global git configuration.
Usage:
gitauth update <username>Example:
gitauth update my-work-accountremove <username>
Removes a user's configuration (the stored email) from gitauth-cli. This does not log the user out from the GitHub CLI.
Usage:
gitauth remove <username>Example:
gitauth remove my-old-accountprintconfig
Prints all the configurations stored by gitauth-cli, showing which emails are associated with which usernames.
Usage:
gitauth printconfig