0

I've changed user name on GitHub, after that I've cloned one of my repos and made some commits using git bash. After I pushed changes and found that my old user name was in commits. How to fix it?

P.S. In credential manager in control panel I see that I've logged to git bash using my new user name.

WideWood
  • 549
  • 5
  • 13
  • `git config [--global] user.name myname` doesn't work, git says that such key doesn't exist, but `git config --global user.name myname` works thanks – WideWood Mar 25 '22 at 22:09
  • @Mushroomator, could you explain me in quick way what's difference between `[--global]` and `--global`? – WideWood Mar 25 '22 at 22:10
  • 1
    Yes `[ ]` only says that this argument is optional. Because you can also set a local git config so it's not expected to work with `[ ]`. You might wanna have a look at this [wikipedia article](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form). This notation is usually used for describing the API of many CLI applications. – Mushroomator Mar 25 '22 at 22:10
  • And if I work with remote repo? – WideWood Mar 25 '22 at 22:11
  • 2
    Your local git config will determine what user/ email your commits will be labelled with. You will have to authenticate though if you want to commit to Github or alike. – Mushroomator Mar 25 '22 at 22:24

1 Answers1

1

Execute this command

git config --global user.name mynewusername