Get github to link your commits to your user account if you have more than one git accounts

Problem

You would like to link the commits to a github repository to your github account but you may have different git accounts (ie gitolite etc).
So you would need to specify in the config file which account you want to use.

Solution

There is a help page in github that describes this problem here, but they recommend to change your global settings which is maybe not what you want.
So you could the following to change only the current project settings:

cd ~/my_project
git config --local user.email="your_github_account_email"

Or add the following to your .git/config file inside your local repository:

[user]
  email = user_name@domain.com
  name = Firstname Surname

And to check the settings:

git config --local -l
git config --global -l