Use case

Fix pushes using the wrong GitHub account

Use this when commits look fine but SSH pushes still authenticate as the wrong GitHub account.

When to use this

Use this page when the repo identity looks right locally, but pushes still go through the wrong GitHub account.

Common signs:

  • gitrole status looks warning-heavy even after switching roles
  • GitHub shows the wrong account when you push over SSH
  • the repository remote is still pointing at the wrong SSH host alias

Start with doctor

Run:

gitrole doctor

doctor is the full explanation view. It is the fastest way to see whether the problem is in the commit identity, the remote configuration, or the SSH auth path.

If you want the raw result for scripting or debugging, use:

gitrole doctor --json

Check the remote

If the role expects a GitHub host alias, the remote needs to point at that alias too.

When doctor shows that the repo host does not match the role, rewrite origin:

gitrole remote set work

That keeps the same owner and repository name, but swaps the host to the alias configured for the work role.

Check your SSH setup

If the remote host is right but pushes still authenticate as the wrong account, inspect the SSH alias in ~/.ssh/config.

Example:

Host github.com-acme-dev
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_work
  IdentitiesOnly yes

Then make sure the saved role points at the same SSH setup:

gitrole add work \
  --name "Alex Developer" \
  --email "alex@work.example" \
  --ssh ~/.ssh/id_work \
  --github-user acme-dev \
  --github-host github.com-acme-dev

Confirm the fix

After updating the remote or SSH alias, rerun the checks:

gitrole status
gitrole doctor

Use status for the quick daily check. Use doctor again if you need to confirm that the remote host and SSH account now match the selected role.