Cookie Engineer's Website

Git Identity

Git Identity Teaser

Overview

Git Identity is a complementary Git Extension to allow better management of multiple git user profiles. The git command line is painful to use for dealing with multiple aliases, hard to remember, and easy to get wrong. That's why this tool exists.

Building

The build process is fully integrated with the Go build toolchain. The only requirement is the installation of the go package which includes all of the software's dependencies.

# install go toolchain
sudo pacman -S go;

# build all supported platform binaries
cd /path/to/git-identity;
bash build.sh;
					

Installation

  • The program binary has to be installed as /usr/bin/git-identity .
  • The ${XDG_CONFIG_HOME}/git-identity folder is the preferred config folder.
  • The ${HOME}/.config/git-identity folder is the first fallback config folder.
  • The /home/${USER}/.config/git-identity folder is the second fallback config folder.
# builds and installs the binary to /usr/bin/git-identity
cd /path/to/git-identity;
bash install.sh;
					

Usage

  • git identity create <alias> creates a new alias with a new keypair.
  • git identity import <alias> imports global git user config as new alias.
  • git identity clone <alias> clones a private repository with SSH key of the specified alias.
  • git identity config <alias> modifies current git repository config to always use specified alias.
  • git identity show prints out available aliases.
  • git identity show-key <alias> prints out the public SSH key for the specified alias.

Usage Example

cd ~/Software;

# import global git/ssh config as new alias
git identity import cookiengineer;

# clone a repo via an aliases' SSH key
git identity clone cookiengineer [email protected]:cookiengineer/private-repository.git ./private-repository;

# modify alias usage inside a repo
cd ./private-repository;
git identity config cookiengineer;
git push origin master; # uses another-alias automatically!

# create another alias
cd ~/Software;
git identity create another-alias;

# easy copy/paste of public key to web apps
git identity show-key another-alias;