7

I want to know if there is a way to change the person(account) who pushed changes in a GitHub repository.

For example: I push to my private repository under a different name(not email) but I misspell one letter of my name and GitHub marks the commit as commited by userame not username;

Qwerty
  • 29,062
  • 22
  • 108
  • 136
Karina Kozarova
  • 1,145
  • 3
  • 14
  • 29
  • 2
    Before a merge, correct? – Goose May 26 '17 at 14:53
  • If after a merge this is the only option : https://stackoverflow.com/questions/750172/change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-git – Ivan86 May 26 '17 at 14:54
  • After someone pushed the changes. – Karina Kozarova May 26 '17 at 14:57
  • 1
    Possible duplicate of [Change the author and committer name and e-mail of multiple commits in Git](https://stackoverflow.com/questions/750172/change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-git) – Rumid May 26 '17 at 16:14
  • 2
    not a duplicate. This is asking for author-change of the whole PR on GitHub, not just changing the author of one or more commits. The author is the person who clicked on "Create Pull Request" in the GitHub UI. You can be the author for a GitHub PR, although you did not do any commit. I checked. – Tilo Oct 13 '19 at 20:21
  • Related, not a duplicate: my Q&A: [How to change the **owner** of a PR on GitHub / How to commandeer an open GitHub PR](https://stackoverflow.com/q/66539231/4561887). – Gabriel Staples Mar 09 '21 at 00:42

3 Answers3

4

I suggest you to fix the committer. Remember that there is a difference between the user who commit, and the committer. The committer is signed inside .git/config folder:

$ cat .git/config
[user]
    name = John Doe
    email = john.doe@example.com

Now, you just need to git commit --amend and git push origin BRANCH -f. The former command commit again (but this time with the committer updated). The latter, overwrite the branch.

sensorario
  • 20,262
  • 30
  • 97
  • 159
3

Easy Steps to Change Author Name of a Commit After Push.

  1. Rebase the repository to the previous commit of the one you want to change by running:1 git rebase –i {{previous-commit-hash}}

  2. The script above prompts you with a list of your commits in descendent order. On this vi/vim view, replace the word pick to edit per each commit you want to edit. Then quit and save.

  3. When the rebase process starts, change the author of a commit by running git commit --amend --author="Author ". Then, continue to next commit using: git rebase –continue

  4. Once the rebase process finishes, push your changes by running: git push -f The steps above will change the author of a commit.

Zack_dahbi
  • 29
  • 1
2

I misspell one letter of my name and GitHub marks the commit

==> in this case, you need rebase.

Pull request task only works on Web GUI, it isn't Git underlying command.

(1) Delete current Pull request.

(2) Rebase your commit with your wishing identify information (email, name).

(3) Create new Pull request.

Vy Do
  • 46,709
  • 59
  • 215
  • 313