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:
rem
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.