'Expected Committer Name Git Push Issue
I'm trying to commit/Push some code to GIT, but when I tried to commit the code using SourceTree it gave me an error:
remote: Push rejected.[K
remote:
remote: refs/heads/Branch Details: 6a5d6d4cdd53db591e53db78c51225a619af487f: expected committer name 'Your Name Complete' but found 'Your Name'[K
remote:
Commit is done, but code is not pushed to remote.
I just noticed in the Global setting that my was "Your Name" and I changed it (TO: Your Name Complete) in Global configuration, also verified the name in Tools --> Options and its showing "Your Name Complete" now.
I also tried:
git config --global user.name "Correct User Name"
git config --global user.email "[email protected]"
but still unable to Push the changes, still the same error can any one help me to push the code to remote repository?
Solution 1:[1]
Following the example of this blog post (it was for a tag, in your case it is for a branch HEAD), you would need to amend at least just the branch HEAD you want to push:
git commit --amend --allow-empty --author="LastName, FirstName <[email protected]>"
And then push.
Solution 2:[2]
Hopefully, if user may reset/revert the local commit and then recommit the code after correcting the name in global configuration, this will make the push successful. Here is a way to revert commit:
git reset HEAD~1 -- revert changes made to the index (i.e., that you have added)
For now, I tried the empty commit and also tried to commit the same file with some space (to attempt a fake commit) but both (above solution and fake commit) did not work for me. Then I just removed the cloned repository and re cloned it and then committed the code again and this time Push was done successfully, as I already changed the name in configurations.
Solution 3:[3]
Posting this answer as I faced a similar issue today and the suggestions provided in other answers for this topic didn't worked for me. Here is what I did to resolve the issue:
a) Verified that user.name and user.email were as expected for local and global git file
Local Git config file -> name 'config', No extension, stored under'.git' directory of local repo folder
Global Git config file -> No name, just extension , named '.gitconfig', stored inside user's profile folder like "C:\Users\yourusername" folder
This was fine.
b) My previous commit was pushed successfully. So, I compared the previous git push and the new git push. I observed that with the new git push I was trying to push more than one commits and though of combining it to single commit. After the commits were combined, I was able to push my changes successfully.
Solution 4:[4]
I faced the same issue, reverting the changes, and then updating the git config and recommitting worked for me.
Solution 5:[5]
This worked for me
To check what the commiter name is in local
git log --pretty=fuller @{u}..HEADMake changes as per global
git config --global user.name "FirstName Lastname"git config --global user.email "[email protected]"This changes only the new commits so to regenerate the commits try to push updated meta
git commit --amend --reset-author
now git push should work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | |
| Solution 3 | Kaashan |
| Solution 4 | Vipul Sharda |
| Solution 5 | Tom |
