Documentation
Complete guide to using bgit 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/master/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.
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
SSH authentication fails
Make sure you've added your public SSH key to GitHub:
- Copy your public key:
cat ~/.ssh/bgit_work.pub- Go to GitHub → Settings → SSH and GPG keys
- Click "New SSH key" and paste the public key
Wrong identity being used
Run the following to reset your configuration:
bgit sync --fixCommand not found
Make sure bgit is in your PATH. Try running:
which bgitIf nothing is returned, reinstall bgit 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