Ever wanted to commit something with a different git user? Here are some strategies.

Switch git user for one repository

Suppose you checkout a repository for a different customer where you have a different git user. To set the user for this new repo use this:

git config user.email youraddress@othercompany.org
git config user.name "your name"

These values are stored in the .git/config of your repository where they can also be edited directly in the file.

Switch git user for all repositories

If you completely switch from assignment and your git user too, use the flag --globalto set it globally for all repositories.

Manually choose user

To clear your repo from the preset user information user the following command. On push you are asked to authenticate yourself with username and password.

git config --local credential.helper ""