gitpersonax
v1.0.3
Published
GitPersonaX - Git profile management tool - quickly switch between multiple Git accounts
Maintainers
Readme
GitPersonaX
A command-line tool similar to GitKraken Profile that helps you quickly switch between multiple Git accounts, including username, email, SSH Key and other configurations.
Features
- ✅ Multiple Git profile management
- ✅ Quick profile switching
- ✅ Automatic git config (user.name, user.email)
- ✅ Automatic SSH config
- ✅ GPG signing key support
- ✅ Interactive UI
Installation
npm install -g gitpersonaxUsage
Add a new profile
gitpersonax addFollow the prompts to enter:
- Profile name (e.g., company, personal)
- Git Username
- Git Email
- SSH Key path (e.g., ~/.ssh/id_rsa_company)
- GPG Signing Key (optional)
List all profiles
gitpersonax list
# or
gitpersonax lsSwitch to a specified profile
# Interactive selection
gitpersonax switch
# Specify directly
gitpersonax switch company
gitpersonax use companyDelete a profile
# Interactive selection
gitpersonax delete
# Specify directly
gitpersonax delete company
gitpersonax rm companyView current profile
gitpersonax currentInitialize config directory
gitpersonax initUsage Examples
Scenario 1: Add company and personal accounts
# Add company account
$ gitpersonax add
Profile name: company
Git Username: John Doe
Git Email: [email protected]
SSH Key path: ~/.ssh/id_rsa_company
GPG Signing Key: (leave empty or enter)
Switch to this profile automatically? No
# Add personal account
$ gitpersonax add
Profile name: personal
Git Username: Jane Doe
Git Email: [email protected]
SSH Key path: ~/.ssh/id_rsa_personal
GPG Signing Key: ABCD1234EFGH5678
Switch to this profile automatically? YesScenario 2: Quickly switch accounts
# View current account
$ gitpersonax current
👤 Current Git Profile:
Name: personal
User: Jane Doe
Email: [email protected]
SSH Key: ~/.ssh/id_rsa_personal
GPG Key: ABCD1234EFGH5678
# Switch to company account
$ gitpersonax switch company
🔧 Updating Git config...
🔐 Updating SSH config...
✅ Switched to profile: company
Username: John Doe
Email: [email protected]
SSH Key: ~/.ssh/id_rsa_companyConfiguration File
The tool creates configuration files in ~/.git-profile/ directory:
profiles.json- Store all profile information
Example content:
{
"profiles": {
"company": {
"username": "John Doe",
"email": "[email protected]",
"sshKey": "~/.ssh/id_rsa_company",
"signingKey": null,
"createdAt": "2025-11-25T15:30:00.000Z"
},
"personal": {
"username": "Jane Doe",
"email": "[email protected]",
"sshKey": "~/.ssh/id_rsa_personal",
"signingKey": "ABCD1234EFGH5678",
"createdAt": "2025-11-25T15:30:00.000Z"
}
},
"current": "personal"
}SSH Configuration
When switching profiles, the tool automatically updates ~/.ssh/config file and adds Host configuration for each profile:
# GitPersonaX: company
Host company
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_company
IdentitiesOnly yes
# GitPersonaX: personal
Host personal
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_personal
IdentitiesOnly yesUsage with different hosts:
# Clone personal repository
git clone git@personal:username/repo.git
# Clone company repository
git clone git@company:username/repo.gitQuick Command Reference
| Command | Description |
|---------|-------------|
| gitpersonax add | Add new profile |
| gitpersonax list | View all profiles |
| gitpersonax switch | Switch profile |
| gitpersonax delete | Delete profile |
| gitpersonax current | View current profile |
Notes
- Ensure SSH Key file exists and path is correct
- Switching profile will modify global git configuration
- Cannot delete current active profile, must switch to another profile first
- Using GPG signing requires pre-configured GPG keys
License
This project is licensed under the MIT License - see the LICENSE file for details.
