I am having this weird issue where I cloned a repository with my credentials (my_correct@email.adress
). But I can not push the changes because I always receive this message:
GitLab: You cannot push commits for 'my_wrong@email.adress' . You can only push commits that were committed with one of your own verified emails.
The issue is that when I check the global and the repository users I find it is my_correct@email.adress
:
Global (below confirms my correct address):
git git config --global user.email
git config --global user.name
Repository (below confirms my correct address):
git git config user.email
git config user.name
What should I do and what is the reason behind this mysterious mystery?
Best Answer
I was able to fix the same issue using this git command:
git commit --amend --reset-author --no-edit
I initially tried to commit with the wrong email but even after setting user.name and user.email in
git config --global
to the correct one, I kept getting the same "You cannot push commits for..." error above.The solution was resetting the author in git - then the push was accepted to Gitlab.
For reference: https://github.com/git-tips/tips#revert-undo-a-commit-by-creating-a-new-commit