Change email address associated with existing commit

I have rights to push to a GitHub repository. The rights are associated with one of my email addresses. I committed in sourcetree, and then tried to push to the github repository. It failed, because SourceTree was using the wrong email address (one of my other ones). 

I have reconfigured Sourcetree to use the right email address in the repository settings, but it's ignoring that when I try to push the commit I've already made - and I can't figure out how to resolve this. reversing the commit says it's just going to create a new one, which leaves me in the same place. 

How can I resolve this?

2 answers

You probably need to use the git command line to modify the commit metadata. I don't know how, but you may have more luck searching for an answer on StackExchange.

The easiest way is this:

  1. [Make sure you have no uncommitted changes and perhaps make a backup of the folder with the clone.]
  2. Do a soft reset to the point right before the (first) commit with the wrong e-mail address.
  3. Create the commit(s) again with the same changes.
  4. Push the stuff again.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,126 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you