A one-liner tool for switching Git identities and credentials with ease.
Alter simplifies managing multiple Git identities by allowing you to switch between different Git profiles in a single command. Whether you're juggling personal and work projects, or managing multiple GitHub accounts, Alter handles the complexity of switching usernames, emails, GPG signing keys, and credential namespaces automatically.
Managing multiple Git accounts is cumbersome:
- Manually switching
user.nameanduser.emailacross projects is error-prone - GPG signing keys require separate configuration
- Credential helpers don't scale well across multiple accounts
- Different platforms (GitHub, GitLab, etc.) need different credentials
Alter solves this by:
- ✨ Storing profiles - Each identity is saved as an isolated, reusable profile
- ⚡ One-command switching - Switch identities with a single consistent command
- 🔐 Secure credentials - Credentials stored with OS-level security (keyring support)
- 🔑 GPG integration - Automatic GPG signing key configuration
- 🌐 OAuth2 support - Setup credentials for GitHub, GitLab, and other Git hosts
- 📱 Project-scoped settings - Apply configurations globally or to specific repositories
- Profile Management: Create, list, delete, and switch between Git identity profiles
- Git Configuration: Automatically configure
user.name,user.email, andcommit.gpgsign - Credential Management: Store and manage credentials for multiple Git hosts
- OAuth2 Authentication: Setup OAuth2 credentials for GitHub, GitLab, and custom hosts
- Keyring Integration: Secure credential storage using the system keyring
- Git Credential Helper: Works as a Git credential helper for seamless authentication
- Verbose Logging: Debug mode for troubleshooting (
--verboseflag)
cargo install alterparu -S alter
# if use pre-built binary
paru -S alter-binOr with yay:
yay -S alter
# if use pre-built binary
yay -S alter-bingit clone https://github.com/AmaseCocoa/alter.git
cd alter
cargo install --path .alter newYou'll be prompted to enter:
- Profile slug (unique identifier, e.g.,
work,personal) - Git username
- Git email
- GPG signing key (optional)
alter use workThis applies the profile globally. To apply it only to the current repository:
alter use work --localalter currentShows your current active profile and authentication status.
alter listDisplays all available profiles with their configurations.
alter newInteractive prompts guide you through creating a new Git identity profile.
alter listShows all saved profiles with username and email information.
alter currentDisplays the currently active profile and credential status.
alter use <slug>Switch to a specific profile globally:
alter use workSwitch to a profile for the current repository only:
alter use work --localReset to default Git configuration:
alter usealter delete <slug>Permanently removes a profile and its associated credentials:
alter delete personalalter cred setup <profile> [--host github.com]Configure OAuth2 credentials for a Git host:
alter cred setup work --host github.comalter cred list <profile>View all configured credentials for a profile:
alter cred list workalter cred revoke <profile> [--host github.com]Remove credentials for a specific host:
alter cred revoke work --host github.comalter cred debug <profile> [--host github.com]Troubleshoot credential storage and retrieval.
Alter can be configured as a Git credential helper for automatic authentication.
Add to your Git configuration:
git config --global credential.helper alterProfiles are stored in your user config directory:
- Linux/macOS:
~/.alter/ - Windows:
%APPDATA%\.alter\
Each profile is a TOML file containing:
[profile]
id = "550e8400-e29b-41d4-a716-446655440000"
[user]
username = "john-doe"
email = "john@example.com"
signingkey = "1234567890ABCDEF"
[credentials]
hosts = ["github.com", "gitlab.com"]Credentials are securely stored in your system keyring, not in plain text files.
# Create work profile
alter new
# Profile slug: work
# Username: john-work
# Email: john@work.company.com
# Signing key: (skip)
# Create personal profile
alter new
# Profile slug: personal
# Username: john-personal
# Email: john@example.com
# Signing key: (skip)
# Setup credentials for work account
alter cred setup work --host github.com
# Setup credentials for personal account
alter cred setup personal --host github.com
# Switch to work profile
alter use work
# Now git commands will use the work account
git push origin main
# Switch to personal profile
alter use personal
# Now git commands will use the personal account
git push origin main# Switch globally to work profile
alter use work
# But in a specific personal project, override locally
cd ~/projects/personal-project
alter use personal --local
# This project now uses the personal profile
# while other projects use the work profile# Create profile with GPG key
alter new
# Profile slug: secure-work
# Username: john-doe
# Email: john@company.com
# Signing key: 1234567890ABCDEF
# Switch to profile
alter use secure-work
# All commits will be signed with the specified GPG key
git commit -m "My signed commit"
# Verify signing is configured
git config user.signingkey
# Output: 1234567890ABCDEFEnable detailed logging for debugging:
alter --verbose <command>Example:
alter --verbose cred setup work --host github.comAlter supports OAuth2 authentication for multiple Git providers. When setting up credentials, you can specify custom hosts:
alter cred setup myprofile --host gitlab.company.com-
Verify the profile is active:
alter current
-
Check credential configuration:
alter cred list <profile>
-
Enable verbose mode for debugging:
alter --verbose cred debug <profile>
To stop using Alter and reset to your default Git configuration:
alter useThis clears any profile-specific settings.
If you encounter keyring-related errors:
- On Linux, ensure a keyring daemon is running (usually part of your desktop environment)
- On macOS, ensure access to the system Keychain is permitted
- On Windows, ensure Windows Credential Manager is accessible
Alter is built on:
- Rust for performance and safety
gix-configfrom the gitoxide project for reliable Git configuration handlingclapfor command-line parsingkeyringcrate for secure credential storagereqwestfor OAuth2 HTTP requests
- Rust 1.70 or later
- Cargo
git clone https://github.com/AmaseCocoa/alter.git
cd alter
cargo build --releaseThe compiled binary will be at target/release/alter.
cargo testContributions are welcome! Please feel free to submit a Pull Request to the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025-2026 AmaseCocoa
For issues, feature requests, or questions, please visit the GitHub Issues page.
Made with ❤️ for developers managing multiple Git identities