gpx (Git Profile Extension) helps you switch Git/SSH identities between projects.
-
Install from crates.io:
cargo install gpx-cli gpx --help
-
Build from source:
cargo build --release ./target/release/gpx --help
-
Initialize GPX files and bootstrap config:
gpx init
-
Remove GPX-managed bootstrap/cache/state when needed (and prune empty GPX root dirs):
gpx deinit
-
Inspect which profile matches the current directory:
gpx check
-
Apply the selected profile now:
gpx apply
-
See current status and diagnostics:
gpx status --verbose gpx doctor
-
List available profiles/rules:
gpx list profiles gpx list rules
-
Run zero-persistence passthrough commands (
gpx gitand no-subcommand mode):gpx git -p work -- fetch gpx -p work -- cat ~/.gitconfig gpx -- git status
- Run
gpx initfirst. - If no config exists, GPX creates a commented template
config.tomlfor you. - Edit
config.tomlto define your profiles and matching rules. - Run
gpx checkandgpx applyto verify and activate.
[core].defaultProfile: Requiredno(but required if no rule can match); Defaultunset; Allowedprofile name.[core].ruleMode: Requiredno; Defaultfirst-match; Allowedfirst-match | highest-score.[core].mode: Requiredno; Defaultglobal-active; Allowedglobal-active | repo-local.[hook].fixPolicy: Requiredno; Defaultcontinue; Allowedcontinue | abort-once.[run].allowProfileOverride: Requiredno; Defaultfalse; Allowedtrue | false.[worktree].allowSharedFallback: Requiredno; Defaultfalse; Allowedtrue | false.[ssh].dynamicMatch: Requiredno; Defaultfalse; Allowedtrue | false.[rule.<name>]: Requiredyesfor automatic switching;profileis required and at least one matcher is required frommatch.path | match.remoteHost | match.remoteOrg | match.fileExists.
Hook installation is command-driven (gpx hook install/uninstall ...) and no longer uses config toggles like hook.shell or hook.git.
You can enable automatic profile updates with shell and/or Git hooks.
-
Install shell hook:
gpx hook install --shell zsh
-
Install Git hook:
gpx hook install --git
-
Install both:
gpx hook install --shell zsh --git
-
Uninstall hooks:
gpx hook uninstall --shell zsh gpx hook uninstall --git
Supported shells: bash, zsh, fish, nushell, tcsh, elvish.
gpx init
gpx deinit
gpx doctor
gpx status [--verbose]
gpx list [profiles|rules] [--json]
gpx check [--cwd <path>] [--json]
gpx apply [--cwd <path>] [--profile <name>] [--dry-run]
gpx hook install [--shell bash|zsh|fish|nushell|tcsh|elvish] [--git]
gpx hook uninstall [--shell bash|zsh|fish|nushell|tcsh|elvish] [--git]
gpx git [-p <name>|--profile <name>] -- <git args...>
gpx [-p <name>|--profile <name>] -- <command args...>
For full config reference and behavior details, see docs/SPEC.md.