First create a new SSH key pair to use with your alternate account.
ssh-keygen -t rsa
Add the public key to your alternate account on Github (Settings > SSH and GPG keys).
Once that’s done, add a new entry in your SSH config, usually located in
Host github.com-something HostName github.com User git IdentityFile ~/.ssh/something
github.com-something is a unique placeholder that SSH will use to resolve the settings to use (in this case, which actual host to connect to, using which private key) — it can be anything you like. Point
IdentityFile to the location of the private key of the SSH key pair.
.git folder of the project you want to commit to using your alternate account, put the following settings in
[user] name = My Alternate Account email = firstname.lastname@example.org [remote "origin"] url = email@example.com:githubuser/repo.git fetch = +refs/heads/*:refs/remotes/origin/*
Make sure the same
github.com-something in the SSH config entry is used as the host in the
url field. Tweak the rest of the settings to your liking.