Skip to content

Latest commit

 

History

History
113 lines (73 loc) · 3.45 KB

README.md

File metadata and controls

113 lines (73 loc) · 3.45 KB

Git Identity Manager

Ever find that managing multiple git identities is a pain? This git transport attempts to make it less painful.

Knowing who you are can be painful

Image credit PBS.org

Requirements

bash, awk, sed, and openssh are available by default on Mac OS X, BSD, and most flavors of GNU/Linux. Git likely needs to be installed. On Mac OS X, installing Git through homebrew is recommended.

Installation

Add git-idm script to your $PATH and make it executable. Then, you can access the script via git idm. See git idm help for usage.

via Homebrew on macOS / Linux / WSL2

A Homebrew tap is available here.

Install with the following command.

brew install fleetwoodmac/git-identity-manager/git-identity-manager

Uninstall

Remove all data stored in $HOME/.gitconfig related to git idm. This will not affect settings used by git.

git idm uninstall

via Homebrew

  • If installed via Homebrew, uninstall by first running git idm uninstall as above.
  • Then, run brew uninstall git-identity-manager
  • Finally, run brew untap fleetwoodmac/git-identity-manager

Quick start

Add your first identity.

git idm add jcool --name "Joe Cool" --email joe@example.com --key ~/.ssh/id_rsa

Activate your identity.

git idm use jcool

Show which identity is active.

git idm active

List all known identities.

git idm list

For more commands see git idm help.

Autotracked identities

You can configure your Git identities to automatically switch depending on what directory you have cloned. For example, let's say you have personal projects and work projects on the same laptop. Assuming you have a work identity and a personal identity configured, the following commands would help you auto-switch identites for repositories under designated paths.

git idm track work --directory ~/git/work
git idm track personal --directory ~/git/github

You can list what directories are tracked by a given identity.

git idm list work --tracked

Which will return output like the following.

work identity will automatically apply to the following directories:
    /home/user/git/work/

Verify the identity has switched with git config user.email.

cd ~/git/work
mkdir example
cd example/
git init

# the email identity should show your work email
git config user.email

License

MIT License