Error in git: You can only push your own commits in this repository

Oleg picture Oleg · Oct 19, 2018 · Viewed 21.7k times · Source

Yesterday I started to recieve errors when trying to push my commit to repo, how to fix it? And I am not admin of this repo.

remote: You can only push your own commits in this repository
remote: Commit commitName was committed by <myName> <[email protected]>
To ssh://bitbucket.awg.ru/repo
 ! [remote rejected] branchName -> branchName (pre-receive hook declined)
error: failed to push some refs to 'ssh://[email protected]/repo'

Update

Thanks everybody, the problem is solved. The problem was on the Bitbucket side, the admininstrator changed some options. Now everything is OK.

Answer

Oleg picture Oleg · Oct 20, 2018

Thanks everybody, problem is solved. Problem was on Bitbucket side, administrator changed some options. Now everything is OK.

UPDATE

As per @Oleg who asked the question. The problem in general happens because of a Bitbucket hook. This hook will reject any push that contains a commit not committed by the user who pushes to the server.

To solve the issue:

  • You must have Admin access to the repository in Bitbucket server
  • Go to the repository in the server
  • Then ⚙ Repository settings in the sidebar
  • Select Hooks
  • Disable Verify Committer hook
  • You are done