If you work with multiple GitHub accounts (personal + work, or multiple clients), this rule prevents accidentally pushing code under the wrong identity.
Replace the example values with your actual accounts:
| GitHub Account | Allowed Repos | Folders |
|---|---|---|
your-personal |
personal-org/* | ~/projects/personal/ |
your-work |
company-org/* | ~/projects/work/ |
- NEVER push, commit, or create PRs as the wrong account for a given org
- NEVER use
gh auth switchwithout verifying the target repo's org matches the account above
- Check the repo remote:
git remote -v - Identify the org from the remote URL
- Verify
gh auth statusshows the correct active account per the table above - If wrong account is active — STOP. Switch first with
gh auth switch --user <correct-user>
Set the correct identity for the folder:
# In personal project folders
git config user.name "your-personal-username"
git config user.email "your-personal@email.com"
# In work project folders
git config user.name "your-work-username"
git config user.email "your-work@company.com"- Immediately close/delete the PR
- Delete the remote branch:
git push origin --delete <branch> - Recreate with the correct account and identity
- Inform the user