Git: “You can only push your own commits in this repository” – when there actually is a problem

I ran into this recently by creating a new Bitbucket repository when having a spelling error in my mail address in settings. I got this error:

remote: You can only push your own commits in this repository
remote: Commit 85eb7acbf42a14b9 was committed by Niklas Ottosson (username) <niklas@worldwideweeb.com>

In the commit 85eb7acbf42a14b9 (initial commit of the new repository) my mail was niklas@worldwideweeb.com when it should have been niklas@worldwideweb.com (only one ‘e’ in ‘web’)

To fix this we need to make sure we have the correct mail address in global settings:

git config --global user.email niklas@worldwideweb.com

and then reset the author of the initial commit

git commit --amend --reset-author --no-edit

This will now replace the previous author with me, and since I now have the correct spelling the commit will be “fixed”

Tested with Git 2.24.3

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.