Jul 16
git: push a local commit to github with your github username
So, you've forked a repository on github or created a new one from scratch?
And then, you decided to work on it on your local computer, and not with the online editor? Ok,
Probably after you've changed something in the local cloned repo, you'd like to push it back to the online master repository at github. But if you do, your changes/commit is credited with your local username, which is probably not identical with the username you use on git?
And then you came here, with a search for how to:
git local commit with remote github username
github push commit with github username
github push with remote github username
git push to github with my correct user name
The solution is, you can set user.name and user.email on a per-repository basis in git via the file .git/config, which is part of every repo! Just issue these commands on the command-line:
git config user.name "<Your github username>"
git config user.email "<the.email@you.used.at.github.com>"
...this, of course, before you do local commits.
Username is just what you log in with. You can find out your configured email on git here.
If you don't configure the right email, you'll end up with a git invalid-email-address note on your commits.