Search code examples
gitgit-bashgit-pushgit-pullgit-config

My Git Pull/Push records from different account


How to change the account in git during pulling/pushing?

I am using git bash in my terminal whenever I pull/push. After that it shows on our repo's activity that I PUSHED as different person.

Here's an Example: 'name-of-other-account-here' pushed to branch master

Which is supposed to be:'my-account-here' pushed to branch master


Solution

  • Change your user/email in git config.

    # Change just for a single repo. Go into the repo.
    $ git config --local user.name <your-name>
    $ git config --local user.email <your-email>
    
    # Or, change globally (for all repos)
    $ git config --global user.name <your-name>
    $ git config --global user.email <your-email>
    
    $ git config --list       # check 'user.name' and 'user.email'