I was juggling work and personal GitHub accounts with separate PATs for a long time and constantly forgetting to switch between them. Needed a way to commit to personal and work projects without the mental overhead of managing two Git identities.
My issue:
```
cd ~/work/important-project
git push
# Authentication failed - using personal PAT for work repo
```
Then the dance:
```
git config user.email "work@company.com"
# Update Git credential helper or remember which PAT to use
# Rinse and repeat every time I switch contexts
```
My solution (I'm sure others exist?)
```
# One-time setup
gitego add work --name "John Doe" --email "john@company.com" --pat "ghp_work_token"
gitego add personal --name "John" --email "john.personal@gmail.com" --pat "ghp_personal_token"
gitego auto ~/work/ work
gitego auto ~/personal/ personal
# Now it just works cd ~/work/any-project
git commit -m "fix bug" && git push # Uses work identity + PAT automatically
cd ~/personal/side-project
git commit -m "new feature" && git push # Uses personal identity PAT automatically
```
How It Works
- Uses Git's native `includeIf` for identity switching
- Acts as a Git credential helper for automatic PAT selection
- Stores PATs securely in your OS keychain
- Single Go binary, works on macOS/Windows/Linux
No more context switching overhead. Just cd and commit.
GitHub: https://github.com/bgreenwell/gitego
Install: go install github.com/bgreenwell/gitego@latest
Feedback welcome!
Keep in mind, I built this as a personal tool, making it public in case others have the similar problems and can benefit from the solution!