Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.45 KB

File metadata and controls

45 lines (31 loc) · 1.45 KB

Git Identity — Multi-Account Safety

If you work with multiple GitHub accounts (personal + work, or multiple clients), this rule prevents accidentally pushing code under the wrong identity.

Setup — Customize This Template

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/

Absolute Prohibitions

  • NEVER push, commit, or create PRs as the wrong account for a given org
  • NEVER use gh auth switch without verifying the target repo's org matches the account above

Before ANY git push or gh pr create

  1. Check the repo remote: git remote -v
  2. Identify the org from the remote URL
  3. Verify gh auth status shows the correct active account per the table above
  4. If wrong account is active — STOP. Switch first with gh auth switch --user <correct-user>

Before ANY git commit

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"

If a mistake happens

  1. Immediately close/delete the PR
  2. Delete the remote branch: git push origin --delete <branch>
  3. Recreate with the correct account and identity
  4. Inform the user