shantanu
shantanu

Reputation: 2008

Change the author of last commit in Git(pushed remotely)


I am trying to change the author name of last commit. As mentioned in Change commit author at one specific commit, I am executing git commit --amend --author="Author Name <[email protected]>" command.
In my git log I can see that name and email have been changed.
But when I am executing git push -f, it is giving me following error

remote: To prevent you from losing history, non-fast-forward updates were rejected.
! [remote rejected] dev -> dev (pre-receive hook declined)

Any idea how can i push this.

Thanks,
Shantanu

Upvotes: 4

Views: 2265

Answers (1)

AlBlue
AlBlue

Reputation: 24040

Your remote server is preventing the push. You need to (temporarily) configure it to permit pushing non-fast-forward changes for that branch to achieve what you want. How you do that depends on which server you are using; for example, if it's a bare Git repository on a server you can change it with git config receive.denyNonFastForwards false.

Upvotes: 2

Related Questions