Skip to main content

Active Profile

Check which Git profile is currently active.

Usage

gpx current

Active profile with local override

Options

OptionDescription
--jsonReturn structured JSON output

Examples

Display active profile (Global only)

When only a global profile is active:

gpx current

Expected output:

Active profile: work
Name: Ada Lovelace
Email: ada@company.com
Scope: global

Display active profile (Local override)

When a local profile is set inside a repository:

gpx current

Expected output:

Active profile: freelance (local override)
Name: A. Lovelace
Email: ada@clientco.com
Scope: local (~/projects/client-app)
Global: work (Ada Lovelace <ada@company.com>)

Display active profile (With Commit Guard)

If the repository has been guarded with gpx guard:

gpx current

Expected output:

Active profile: work (local override)
Name: Ada Lovelace
Email: ada@company.com
Scope: local (~/projects/company-app)
Global: work (Ada Lovelace <ada@company.com>)

Commit Guard: Enabled ✓ (Locked to: 'work')

Structured JSON Output

gpx current --json

Expected output:

{
"success": true,
"data": {
"active": {
"profile": "work",
"scope": "local",
"auth_method": "ssh"
},
"global": {
"profile": "personal",
"name": "Alan Turing",
"email": "alan@gmail.com",
"signingKey": null
},
"local": {
"profile": "work",
"name": "Ada Lovelace",
"email": "ada@company.com",
"signingKey": null
},
"guard_status": "pass",
"guard_message": "Enabled ✓ (Locked to: 'work')"
}
}
NOTE

guard_status can be "pass", "warn", or "fail". "fail" occurs when the pre-commit hook is installed, but the repository is missing the gpx.expectedprofile configuration (meaning you should run gpx guard again).

What happens behind the scenes

gpx checks your current context by:

  1. Reading ~/.gpx/active.json to determine the globally active profile.
  2. Reading .git/config (if inside a repository) to see if a local identity override is set.
  3. Checking the repository's .git/hooks/pre-commit script to see if the Commit Guard is active.
  • gpx use - Change the active profile.
  • gpx guard - Lock a repository to a specific profile.