Override configured user for a single git commit


I am trying to commit to a project on github.com from my work laptop, which is already configured for the company git server. Is there a way to commit specifying different author credentials, possible using a different configuration file or orther command line switches?

I’ve tried using

and I received the message:

but it still didn’t update my username for committing to the github.com project. Is there anything else I can try and is it even possible?


First, the author is not necessarily the same as the committer. Git tracks both.

To set what name to use for just this repository, you could do:

Notice the absence of the --global option. This will set the configuration in this repository only.

Alternatively, you can do this for only a single command, using the -c option:

But I think it’s better to just use the config options above.

Leave a Reply