6

I made a mistake while setting up my GitHub information, so when I pushed to a repository X the name that appeared is not my name. How can I fix it and say that was me? is there any way to do that?

In BitBucket there is an option in repo admin page called "Username aliases".

Note: I'm an admin in the repository X.

Kendrick
  • 3,747
  • 1
  • 23
  • 41
MhdAljuboori
  • 475
  • 4
  • 15
  • You need to correct your local repository, and force-push to github to fix the problem. – Vincent Cantin Apr 20 '12 at 21:02
  • I can't do that now because there are so mush commits after this commit :(, and how to to correct my name in my local repo. – MhdAljuboori Apr 20 '12 at 21:05
  • http://help.github.com/change-author-info/ (warning: destructive action if others are using your repo) – Abe Voelker Apr 20 '12 at 21:05
  • @AbeVoelker i have others on repo :( – MhdAljuboori Apr 20 '12 at 21:09
  • 2
    @MhdAljobory if it's only a few collaborators, you can ask if they won't mind committing what they have and doing a fresh clone from you after you do a force push. if it's a public repo in use by a bunch of other people, you'll just have to live with it as git won't let you rewrite history like that. – Abe Voelker Apr 20 '12 at 21:10
  • As an aside, you can associate multiple email addresses with a single GitHub account (https://github.com/settings/emails), which may be necessary for all of your commits to be associated with your GitHub username (this still won't fix the committer name in the git repository itself). – Josh Rosen Apr 20 '12 at 21:19

1 Answers1

5

In general, the way to indicate that you have some commits with the wrong email address and wish to correct that for people looking at the history in the future is to use the .mailmap file. This is documented in the git shortlog manual page. In order to use it, each line should start with your correct name and address, and then continue with any name/address combinations that appear in the history that you wish to map to that correct name and address. For example:

Mhd Aljobory <aljobory@example.com> Wrong Name <example@laptop.(none)>

I don't know if GitHub supports translating via mailmap or not, but this is the standard way that various Git tools use for solving this problem.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340