Documentation
Complete guide to using the bgit CLI tool for managing multiple Git identities
On This Page
Installation
Linux
curl -L https://github.com/byterings/bgit/releases/latest/download/bgit-linux-amd64 -o bgit
chmod +x bgit
sudo mv bgit /usr/local/bin/For ARM architecture (Raspberry Pi, etc.), use bgit-linux-arm64
macOS
Intel Macs:
curl -L https://github.com/byterings/bgit/releases/latest/download/bgit-darwin-amd64 -o bgit
chmod +x bgit
sudo mv bgit /usr/local/bin/Apple Silicon (M1/M2/M3):
curl -L https://github.com/byterings/bgit/releases/latest/download/bgit-darwin-arm64 -o bgit
chmod +x bgit
sudo mv bgit /usr/local/bin/Windows
Run this command in PowerShell:
irm https://raw.githubusercontent.com/byterings/bgit/main/install.ps1 | iexVerify Installation
bgit --versionYou should see the version number printed
Getting Started
Initialize bgit
bgit initThis sets up bgit on your system and creates the necessary configuration directory at ~/.bgit/
Add your first identity
bgit addThis launches an interactive wizard that will ask for alias, name, email, GitHub username, and SSH key setup.
Add more identities
bgit addRepeat the command to add your other accounts (personal, clients, etc.)
Switch between identities
bgit use workAll subsequent Git operations will use the selected identity. Your global .gitconfig and SSH configuration are updated automatically.
Usage Guide
Switching Identities
bgit use personalChanges your active Git identity. All future commits will use this identity's name, email, and SSH key.
Viewing All Identities
bgit listShows all configured identities. The currently active identity is marked with a → symbol.
Checking Active Identity
bgit activeShows which identity is currently active with full details.
Cloning Repositories
bgit clone https://github.com/org/repo.gitClones a repository using the active identity's SSH config. Accepts any GitHub URL format.
Fix Repository Remote
bgit remote fixConverts current repo's remote URL to use active identity's SSH config. Run inside a git repo.
Validating Configuration
bgit sync --fixValidates that your Git and SSH configurations are correct. Use --fix to automatically correct any issues.
Removing an Identity
bgit delete workRemoves an identity from bgit. Optionally deletes SSH keys.
Updating SSH Keys
bgit update work --ssh-key ~/.ssh/new_keyUpdates the SSH key for an existing identity. Useful for adding a key to a user created without one.
Tip: Cloning Made Easy
Use bgit clone to automatically clone with the correct SSH config:
bgit clone https://github.com/org/repo.gitThis works with any GitHub URL format. bgit converts it to use the active identity's SSH key automatically.
Pro Tip: After switching identities with bgit use, you can continue using regular git commands as normal. bgit only manages your configuration—it doesn't wrap or replace git.
Workspaces
Workspaces let you organize projects by identity. Clone repos inside a workspace folder and bgit automatically uses the correct identity.
Create Workspaces
cd ~/projects
bgit workspace
# Creates folders for each identity:
# ~/projects/work/ → uses "work" identity
# ~/projects/personal/ → uses "personal" identityClone Inside Workspace
cd ~/projects/work
bgit clone https://github.com/company/repo.git
# Uses "work" identity automatically!
cd ~/projects/personal
bgit clone https://github.com/me/hobby.git
# Uses "personal" identity automatically!Bind Individual Repos
For repos not in a workspace, bind them to an identity:
cd existing-repo
bgit bind --user work
# This repo now always uses "work" identityBenefit: No need to remember to switch identities. Just work in the right folder and bgit handles the rest.
Identity Resolution
bgit determines which identity to use based on your current location:
Workspace
If inside a workspace folder, use that workspace's identity
Binding
If the repo has an explicit binding, use the bound identity
Global
Otherwise, use the global active user from bgit use
Check Current Resolution
bgit statusShows which identity will be used and why (workspace, binding, or global).
Configuration
Configuration Files
bgit stores all configuration in ~/.bgit/config.toml. This file contains:
- All your configured identities
- Currently active identity
- SSH key paths and Git configuration for each identity
SSH Keys
By default, bgit generates Ed25519 SSH keys in ~/.ssh/ with names like:
~/.ssh/bgit_work~/.ssh/bgit_personal
You can also use existing SSH keys during the bgit add process.
Git Configuration
bgit modifies your global Git configuration (~/.gitconfig) to update:
user.nameuser.email
All other Git settings remain unchanged.
Troubleshooting
Quick Fix: Run Doctor
For most issues, start with the doctor command:
bgit doctor --fixThis checks config, SSH permissions, and can auto-fix common problems.
SSH authentication fails
Run diagnostics with network check:
bgit doctor --networkIf your key isn't on GitHub, copy it and add to GitHub Settings → SSH keys:
cat ~/.ssh/bgit_work.pubWrong identity being used
Check which identity is active and why:
bgit statusIf you're in a workspace or bound repo, that identity takes precedence.
SSH permission errors
SSH requires specific permissions. Auto-fix with:
bgit doctor --fixThis sets ~/.ssh to 700 and key files to 600.
Command not found
Make sure bgit is in your PATH:
which bgitIf nothing is returned, reinstall following the installation instructions.
Still having issues? Report an issue on GitHub
Frequently Asked Questions
Next Steps
Explore the full command reference or get help from the community