Git identity switching for real projects

gitshift

A lightweight CLI for switching Git identities and GitHub SSH profiles per repository.

curl -fsSL https://raw.githubusercontent.com/void-wizard/gitshift/main/install.sh | bash
~/projects/app
$ gitshift list
Saved profiles
work Alice alice@company.com github-work
personal Alice alice@example.com github-personal

$ gitshift use work
Applied profile to current repository
Git user.name: Alice
Git user.email: alice@company.com

$ git status
Git repository: /projects/app
Git user.name: Alice
Git user.email: alice@company.com

On branch main
nothing to commit, working tree clean

Keep every repository on the right identity.

gitshift helps developers who move between personal, work, client, and open source accounts without accidentally committing with the wrong Git user or SSH key.

id

Profile-based Git config

Save multiple names and emails, then apply them to the current repository using local Git configuration.

ssh

GitHub SSH hosts

Bind profiles to SSH host aliases so clones and pushes use the matching GitHub account.

st

Status awareness

Show the active repository identity before normal Git status output, right where mistakes usually happen.

Commands you run, and what happens next.

gitshift is built around a small set of commands. Each one does one visible thing: install the tool, create profiles, apply an identity, clone with the right SSH host, or show the current repository identity.

Install gitshift

Run the installer, then reload your shell configuration so the gitshift command is available in your terminal.

curl -fsSL https://raw.githubusercontent.com/void-wizard/gitshift/main/install.sh | bash source ~/.zshrc
Result: gitshift is installed under ~/.gitshift, added to your shell path, and ready to run in new terminal sessions.
Use source ~/.bashrc instead if Bash is your default shell. Installed files live under ~/.gitshift.
Initialize gitshift storage

Run init once to create the local files gitshift uses to store profiles.

gitshift init
Result: gitshift prepares its configuration directory and profile file under ~/.gitshift.
You can run this command again safely if you want to make sure gitshift storage exists.
Add a profile

Run add to create a named identity profile. gitshift will ask for these fields during setup.

gitshift add
Profile name work The short name you use later with commands like gitshift use work.
Git user.name Alice The author name Git writes into commits.
Git user.email alice@company.com The author email Git writes into commits.
GitHub owner company The GitHub account or organization used when matching clone targets.
SSH host github-work The host alias in ~/.ssh/config that uses the right SSH key.
Result: gitshift saves a profile record that connects a profile name, Git identity, GitHub owner, and optional SSH host.
Avoid special characters in profile names, names, emails, and GitHub owners so profile lookup remains predictable.
Apply a profile to a repository

Run this inside a Git repository. In this example, work is the profile name you entered when running gitshift add.

gitshift use work
Result: the current repository now commits with the Git user name and email stored in the work profile. Other repositories keep their own identities.
Local config affects only the current repository, so your global Git identity remains unchanged.
Clone with the matching SSH identity

When a profile is bound to a GitHub owner and SSH host, gitshift can clone using the right host alias automatically.

gitshift clone owner/repo gitshift clone git@github.com:owner/repo.git gitshift clone https://github.com/owner/repo.git
Result: gitshift detects the GitHub owner, chooses the matching saved profile, rewrites the clone URL to the matching SSH host, and clones the repository.
This is useful when work and personal GitHub accounts use different SSH keys on the same machine.
Check what identity is active

Use who when you want a quick answer, or let the shell hook show identity information before normal Git status output.

gitshift who git status
Result: gitshift prints the current repository path, Git user name, and Git email before you commit.
The status hook helps catch the most common mistake before you commit: the wrong name, email, or account context.
Manage saved profiles

List profiles when you forget a name, remove one profile when it is no longer needed, or clear all profiles before rebuilding your setup.

Show all profiles gitshift list Prints the profiles saved on this machine.
Remove one profile gitshift remove work Deletes the selected profile from gitshift storage.
Remove all profiles gitshift remove --all Clears every saved profile after confirmation.
Open command help gitshift help Shows available commands and usage examples.
Profile data is stored in ~/.gitshift/profiles. Avoid special characters in profile names, names, emails, and GitHub owners.

Stop discovering the wrong Git identity after the commit.

Use one small command to make each repository remember who it belongs to.

Get gitshift