If I committed to github with a wrong local credentials (username and password), will it be possible to change the committer name on github? This issue can happen if you have two git accounts! By the way I'n not asking how to reconfigure your local git account.
Asked
Active
Viewed 1.4k times
2 Answers
31
1- configure your new username and email with
change username: git config username.user <username>
change email: git config username.email <email>
2- run this command git commit --amend -C HEAD --reset-author
3- run this command git push --force
This will change the other in the last commit.
foobar
- 133
- 2
- 7
-
1for me `git config user.email
` worked – ericdemo07 Nov 26 '21 at 19:34 -
Using `git config user.name
` and `git config user.email – mmccabe Nov 30 '21 at 15:34` worked for me
6
You can change the last commit locally with
git commit --amend --author="Author Name <email@address.com>"
Then do a
git push --force
This will force the authored commit over the top of the old one.
hardillb
- 47,764
- 9
- 59
- 93
-
1Did not work for me. I got `fatal: --author 'username
' is not 'Name – Amjad Dec 27 '16 at 18:14' and matches no existing author` -
try replacing "Author Name
" with just the email address of the user you wish to use – hardillb Dec 27 '16 at 18:16 -
I did I just did not want to share them publicly here that is why I change them. – Amjad Dec 27 '16 at 18:17
-