↔️ Git Profile helps you manage multiple Git identities and switch between them per repository
Git Profile
Git Profile helps you manage multiple Git identities and switch between them per repository.

Installation
Homebrew
brew install dotzero/tap/git-profile
Prebuilt binaries
Download a binary from the releases page and place it in a directory listed in $PATH.
Build from source
go install github.com/dotzero/git-profile@latest
The binary will be installed to $GOBIN or $GOPATH/bin.
Quick start
Create a profile in interactive mode:
git-profile add
Apply a profile in the current Git repository:
git-profile use
Usage
add
Add a key to a profile or update an existing one:
git-profile add work user.name "John Doe"
git-profile add work user.email work@example.com
git-profile add work user.signingkey AAAAAAAA
Run without arguments to start interactive mode:
git-profile add
Interactive mode asks for:
- profile name
user.nameuser.emailuser.signingkey
list
Show all available profiles:
git-profile list
del
Delete a profile or a specific key from a profile:
git-profile del
git-profile del work
git-profile del work user.email
When called without arguments, del opens an interactive profile selector and deletes the selected profile. Press Esc or Ctrl+C to cancel.
use
Apply a profile to the current Git repository:
git-profile use work
Under the hood, this writes local Git config values, for example:
git config --local user.name "John Doe"
git config --local user.email work@example.com
git config --local user.signingkey AAAAAAAA
Run without arguments to select a profile interactively:
git-profile use
use must be executed inside a Git repository.
unuse
Remove the applied profile entries from the current Git repository:
git-profile unuse work
Under the hood, this unsets the local Git config values, for example:
git config --local --unset user.name
git config --local --unset user.email
git config --local --unset user.signingkey
Run without arguments to remove the currently applied profile:
git-profile unuse
unuse must be executed inside a Git repository.
current
Show the currently selected profile for the current repository:
git-profile current
export
Export a profile as JSON:
git-profile export work
git-profile export work > work.json
Example output:
[
{ "key": "user.name", "value": "John Doe" },
{ "key": "user.email", "value": "work@example.com" },
{ "key": "user.signingkey", "value": "AAAAAAAA" }
]
import
Import a profile from JSON:
git-profile import work '[{"key":"user.name","value":"John Doe"},{"key":"user.email","value":"work@example.com"}]'
If you already have JSON in a file:
git-profile import work "$(cat work.json)"
Config file
By default, Git Profile stores profiles in:
~/.gitprofile
You can override it with:
git-profile --config /path/to/file add work user.email work@example.com
Shell Completion
Shell completion is available for git-profile.
Note: use git-profile ..., not git profile ..., when generating or using completion.
Bash
Requires bash-completion.
source <(git-profile completion bash)
To install permanently:
git-profile completion bash | sudo tee /etc/bash_completion.d/git-profile
On macOS:
git-profile completion bash > $(brew --prefix)/etc/bash_completion.d/git-profile
Zsh
mkdir -p ~/.zsh/completions
git-profile completion zsh > ~/.zsh/completions/_git-profile
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -U compinit && compinit' >> ~/.zshrc
source ~/.zshrc
Fish
git-profile completion fish | source
git-profile completion fish > ~/.config/fish/completions/git-profile.fish