Using Different GitHub Account for a Repo on the Same Machine

If you have Git installed and already have your global config and ssh established for your GitHub account but need to create a separate account for your repo follow these steps.

  1. Create a local git config within the new repo
    • git config --local user.name "[YOUR_NAME]"
    • git config --local user.email "[YOUR_EMAIL]"
  2. Create new keys to be added to your GitHub account
    • ssh-keygen -t ed25519 -C "[COMMENT]"
  3. Define git to use the newly created key for the account
    • git config --add --local core.sshCommand 'ssh -i ~/.ssh/id_ed25519'

Leave a comment