Github commits linked to the wrong user [Solved]

I have been using my Ubuntu desktop for a long time and all my commits were getting deployed to github remote repo without any issue. Few days back, someone else used my machine for few days. Now when I am pushing any code to guthib, its asking my for credentials but when I am checking my github repository, a different users name is displayed.

check current user configured by following command

$ git config --global --list LastName

We need to change it. It can be changed by two ways

  1. By editing .gitconfig file

.gitconfig is located in your home directory. File content is as below

     name =
     email =
    default = simple

You can simply edit the file to required name and email.

You can open this file using following command as well

git config --global -e

2.  Changing details using command line

git config --global --unset-all
git config --global --unset-all

You can add required details as below

git config --global --add <YourGithubUserName>
git config --global --add <YourGithubemail>

if you want to change user names without resetting

git config --global <YourGithubUserName>
git config --global <YourGithubemail>

Leave a Reply

Your email address will not be published. Required fields are marked *