Skip to content

Git identity manager. It allows you to switch between git identities for user, name, and SSH private key used for authoring and publishing git commits.

License

Notifications You must be signed in to change notification settings

samrocketman/git-identity-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Git identity manager. It allows you to switch between git identities for user, name, and SSH private key used for authoring and publishing git commits.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages