How to amend default user name and email before committing code to remote github repository

If you commit the code to a local github repo with the default user name, you will get the message as shown below:
$ git commit MumbaiStock.pm -m v1.5 <enter>
[master 24fea3] v1.5
 Committer: wronguser <wrongemail@wrongdomain.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config –global –edit

After doing this, you may fix the identity used for this commit with:

    git commit –amend –reset-author

 1 file changed, 9 insertions(+), 2 deletions(-)

$ git config --global --edit <enter>
Now enter the right user name and email ID

$ git commit --amend --reset-author <enter>
Will correct the user name and email ID.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s