Skip to content

Repository files navigation

Git-Config-Manager

Switch Git identities without leaving your terminal.

A fast, focused CLI for managing Git profiles per repository.

Release CI License Rust

g keeps your work, personal, and open-source Git identities separate. Save each identity once, then apply the right name, email, signing key, and SSH host alias to the current repository in one command.

$ g use work
Successfully write profiles into .git/config

Why g?

  • Repository-first — changes are scoped to the current repository by default, so one project never leaks its identity into another.
  • Interactive when you want it — launch the terminal UI with g, or use explicit subcommands in scripts.
  • Signing-aware — switches user.signingkey and commit.gpgsign together.
  • Multiple GitHub accounts — optionally rewrites SSH remotes through an alias from ~/.ssh/config.
  • Safe updates — validates first and rolls back Git configuration if a write fails.

Install

Install the latest release on Linux or macOS:

curl --proto '=https' --tlsv1.2 -LsSf \
  https://raw.githubusercontent.com/frankittee/Git-Config-Manager/main/install.sh | sh

The installer verifies the release checksum and places g in ~/.local/bin.

# Choose a different installation directory
curl --proto '=https' --tlsv1.2 -LsSf \
  https://raw.githubusercontent.com/frankittee/Git-Config-Manager/main/install.sh | \
  G_INSTALL_DIR="$HOME/bin" sh

# Install a specific version
curl --proto '=https' --tlsv1.2 -LsSf \
  https://raw.githubusercontent.com/frankittee/Git-Config-Manager/main/install.sh | \
  G_VERSION="0.4.0" sh

Quick start

Create a profile:

$ g add work
Git author name: Ada Lovelace
Git author email: ada@company.example
Enable commit signing? [y/N]: y
Signing key: ABC123
SSH host alias (leave blank to skip): github-work
work

Apply it inside a Git repository:

cd my-project
g use work

Check which saved profile matches the repository:

g info

Terminal UI

Run g without a subcommand to manage profiles from the interactive terminal interface:

g
Key Action
↑ / ↓, j / k Navigate profiles
Enter, u Apply selected profile
a Add a profile
e Edit selected profile
d Delete selected profile
q Quit

When adding or editing a profile, use Tab to move between fields, Space to toggle commit signing, Enter to save, and Esc to cancel.

Command reference

Command Description
g Open the terminal UI
g add <profile> Create a profile
g edit <profile> Edit a profile
g list List saved profiles
g show <profile> Show profile details
g use <profile> Apply a profile
g info Show the matching active profile
g remove <profile> Remove a profile

All profile fields can also be provided as flags, which makes g convenient in scripts:

g add personal \
  --name "Ada Lovelace" \
  --email "ada@example.com"

g add work \
  --name "Ada Lovelace" \
  --email "ada@company.example" \
  --signing-key "ABC123" \
  --ssh-host github-work

g edit work --email "new-address@company.example"
g edit work --no-signing
g edit work --no-ssh-host

Run g <command> --help for every available option. The terminal UI and prompts require a TTY; in CI, provide both --name and --email when adding a profile.

How it works

Profiles are stored in:

$HOME/.config/git-config-switch/config.toml

Set G_CONFIG_DIR to override the containing directory, for example in isolated automation or tests.

By default, g use updates the current repository's local Git configuration. When run directly from your home directory, it updates the global Git configuration instead.

If a profile has a signing key, g use sets user.signingkey and enables commit.gpgsign. Applying a profile without a signing key removes both settings from the selected Git configuration scope.

If a profile has an ssh_host, g first verifies that the literal Host alias exists in ~/.ssh/config or an included configuration file, then rewrites SSH fetch URLs and explicit push URLs for every remote to use that alias. Include paths support paths relative to ~/.ssh, absolute paths, ~, nested includes, and glob wildcards. HTTPS and local URLs are left unchanged. Validation or write failures leave both identity and remote configuration unchanged.

Release process

Pushing a v* tag builds Linux x86_64/ARM64 musl binaries and native macOS Intel/Apple Silicon binaries. The tag must match the version in Cargo.toml.

# Creates the version commit, updates Cargo.toml and Cargo.lock, generates CHANGELOG.md, and creates a v* tag.
mise x -- cog bump --auto
git push --follow-tags

Normal branch pushes do not trigger release builds.

License

Released under the MIT License.


Built for developers who use more than one Git identity.

About

g is a fast Rust CLI for switching Git identity profiles per repository.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages