Manage your Git identity across multiple accounts and projects.
gitup
is cross-platform CLI tool designed to check, install, and manage your Git configurations with ease. The profile management, allows to switch between work, personal, and other Git accounts with a single command.
- Git Installation Check: Verifies if Git is installed on your system.
- Cross-Platform Guidance: If Git is not installed,
gitup
provides the correct installation command for your OS. - Interactive Setup: A guided
gitup setup
command for new users that configures name, email, and signing key, then offers to save it all as a profile. - Cryptographic Signing: Associate GPG/SSH signing keys with your profiles to ensure all commits for that identity are automatically and correctly signed.
- Effortless Profile Management: Save multiple Git configurations and switch between them seamlessly.
- Interactive Switching: Simply run
gitup use
to get an interactive list of profiles to choose from. - Shell Completions: Generate completion scripts for Bash, Zsh, Fish, and other shells for a faster workflow.
- Script-Friendly: A global
--json
flag provides machine-readable output for all commands. - Secure by Design: Does not require or execute commands with
sudo
itself; it empowers the user to run provided installation commands securely.
You will need the Rust toolchain (version 1.70 or newer) installed.
-
Install from Crates.io (Recommended):
cargo install gitup
-
Build from Source:
# Clone the repository git clone https://github.com/gni/gitup.git cd gitup # Build the release binary cargo build --release # The executable will be at `target/release/gitup` # For global access, move it to a directory in your PATH mv target/release/gitup /usr/local/bin/
For first-time use, the setup
command is the best starting point. It will guide you through setting your name, email, and an optional GPG/SSH signing key. It will then ask if you want to save the result as your first profile.
gitup setup
To see your current global user.name
, user.email
, user.signingkey
, and the active gitup
profile.
gitup check
Alias: gitup status
This is the core feature for managing multiple Git identities.
Run use
without a name for an interactive selector. This is the easiest way to switch contexts.
$ gitup use
? Select a profile to use ›
personal
❯ work
Or switch directly if you know the name: gitup use personal
This command reads your current global Git configuration (including signing key) and saves it as a named profile.
# First, ensure your global config is what you want to save
gitup set -n "Work User" -e "work.user@example.com" -s "A1B2C3D4"
# Then, save it
gitup save work
gitup list
Alias: gitup ls
You will see a list of your profiles, with the active one highlighted.
Saved Profiles
- personal
- work (active)
gitup current
Alias: gitup active
gitup delete work
Alias: gitup rm
To enable shell completions, you need to generate the script for your shell and source it in your shell's configuration file (e.g., .bashrc
, .zshrc
).
Add the following to your ~/.bashrc
:
eval "$(gitup completions bash)"
Add the following to your ~/.zshrc
:
eval "$(gitup completions zsh)"
Add the following to your ~/.config/fish/config.fish
:
gitup completions fish | source
For use in scripts or CI/CD environments.
# Set config using long flags
gitup set --name "User" --email "user@example.com" --signing-key "A1B2C3D4"
# Or with short flags
gitup set -n "User" -e "user@example.com" -s "A1B2C3D4"
# Unset a signing key by passing an empty string
gitup set -s ""
# Flags can also be populated from environment variables
export GITUP_USER_NAME="User"
export GITUP_USER_EMAIL="user@example.com"
export GITUP_SIGNING_KEY="A1B2C3D4"
gitup set
gitup
stores its profile data in a simple JSON file located at:
- Linux/macOS:
$HOME/.config/gitup/config.json
- Windows:
{FOLDERID_RoamingAppData}\gitup\config.json
It is recommended to manage this file through the CLI commands.
Contributions, issues, and feature requests are welcome. Please check the issues page for this project.
This project is licensed under the MIT License.
Lucian BLETAN