Catchy SwiftBar plugin to switch Git + SSH identity from your macOS menu bar.
- ✅ Up to 5 profiles
- ✅ One-click switching in SwiftBar
- ✅ Updates global Git identity (
user.name,user.email) - ✅ Updates SSH identity per host in a managed block in
~/.ssh/config - ✅ Optional CLI wizard to add profiles quickly
- What it changes
- Requirements
- Install
- How it looks
- Menu actions explained
- Configure profiles
- Profile format
- Notes & safety
- Development
- License
When you switch profile, the plugin updates:
git config --global user.namegit config --global user.email- A managed block in
~/.ssh/configfor the configured host (placed at the top for priority):
# >>> git-persona-bar:github.com >>>
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentitiesOnly yes
IdentityFile ~/.ssh/your_key
# <<< git-persona-bar:github.com <<<
It also runs:
ssh-add -D(clear current loaded keys)ssh-add <selected-key>
- macOS
- SwiftBar
bash,python3,git,ssh-add
git clone https://github.com/IryArkhy/git-persona-bar.git
cd git-persona-bar
./scripts/install.shinstall.sh also sets plugin visibility in SwiftBar preferences and restarts SwiftBar (if running) so the icon appears immediately.
Then in SwiftBar (if needed):
- Refresh plugins, or restart SwiftBar.
These are the plugin actions you see in the dropdown:
-
Switch to
- Applies the selected profile (
git config --global user.name/email) - Updates managed
Hostblock in~/.ssh/config - Reloads SSH key in agent (
ssh-add -D+ssh-add <key>)
- Applies the selected profile (
-
Open Config File
- Opens
~/.config/git-persona-bar/profiles.jsonin your default editor
- Opens
-
Add Profile (wizard)
- Opens a Terminal window/session intentionally
- Asks a short interactive set of questions:
- profile id
- label
- icon
- git
user.name - git
user.email - SSH host (default:
github.com) - SSH key path (e.g.
~/.ssh/id_ed25519_work)
- Writes the profile into
~/.config/git-persona-bar/profiles.json - Optionally asks if you want to open the config file
- Safety: no
sudo, no key contents read/uploaded, no network calls
-
Install / Relink Plugin
- Opens Terminal and creates/refreshes a symlink from SwiftBar plugin directory to this repo script
- Ensures script is executable
- Useful after moving repo folders
-
Validate Config
- Opens Terminal and validates JSON structure and limits (max 5 profiles)
- Prints clear errors if config is invalid
-
Refresh
- Tells SwiftBar to rerun the plugin immediately
Note: menu items like Run in Terminal…, Disable Plugin, About are SwiftBar built-in actions, not provided by this plugin.
Config file:
~/.config/git-persona-bar/profiles.json
Run the following commands from the cloned
git-persona-barrepository root.
Create/edit it manually from template:
mkdir -p ~/.config/git-persona-bar
cp ./config/profiles.example.json ~/.config/git-persona-bar/profiles.json
open ~/.config/git-persona-bar/profiles.jsonOr use the wizard:
./scripts/add-profile.sh- Open config:
open ~/.config/git-persona-bar/profiles.json- Remove the profile object from the
profilesarray. - Save the file.
- Refresh SwiftBar.
If the removed profile was active, reset plugin state:
rm -f ~/.config/git-persona-bar/state.jsonValidate config after changes:
./git-persona-bar.5s.sh validate{
"profiles": [
{
"id": "work",
"label": "Work",
"icon": "💼",
"git": {
"name": "Your Name",
"email": "you@company.com"
},
"ssh": {
"host": "github.com",
"identity_file": "~/.ssh/id_rsa_work"
}
}
]
}- Max profiles: 5
- Profile IDs must be unique and use:
a-z A-Z 0-9 _ -
- Do not commit private SSH keys.
- Use key paths only (e.g.
~/.ssh/id_ed25519_work). - Plugin creates timestamped backup copies of
~/.ssh/configbefore updates. - Existing
Host github.comblocks can remain; the managed block is written at top so selected identity wins. - You may see a one-time macOS notification permission prompt when profile switch notifications are shown.
- If config becomes invalid, plugin shows a warning icon and gives quick actions.
Run locally:
bash ./git-persona-bar.5s.shValidate config:
bash ./git-persona-bar.5s.sh validateMIT
