Marius Butuc
Marius Butuc

Reputation: 18250

Pushing to bitbucket: authorization failed

I'm a git & github user that's new to mercurial & bitbucket and I'm trying to use bitbucket for a project.

So far I've got write access to a new private bitbucket repository, and I got started by:

  1. cloning
  2. adding my existing project
  3. committing
  4. trying push, I get authorization failed via:

HTTPS

$ hg push https://[email protected]/DB2UAdmin/repo
http authorization required
realm: Bitbucket.org HTTP
user: mariusbutuc
password: 
pushing to https://[email protected]/DB2UAdmin/repo
searching for changes
abort: authorization failed

SSH

$ hg push ssh://[email protected]/DB2UAdmin/repo
pushing to ssh://[email protected]/DB2UAdmin/repo
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 9664 changes to 9664 files
remote: You're not allowed to write to this repository.
remote: transaction abort!
remote: rollback completed
remote: abort: pretxnchangegroup.bb_perm hook failed

also attempted via simple HTTP, got similar results as with HTTPS.

How can I get it to work?

Extra details:

Upvotes: 5

Views: 7452

Answers (2)

Simon Francesco
Simon Francesco

Reputation: 1561

For those of you that arrive here from googling "pretxnchangegroup.bb_perm hook failed" this can be caused by trying to merge to a branch that you do not have the "write" permission under "branch permissions" on bitbucket. Presumably this is because you should have used a pull request for the merge rather than going ahead and merging on your local.

Upvotes: 1

Marius Butuc
Marius Butuc

Reputation: 18250

  1. The bitbucket account was opened under my gmail address [addr A].
  2. The SSH key was made using the address from my company [addr B].
  3. addr B was added to my account as a secondary address.
  4. I had writing access for the mariusbutuc account, that had both addresses.

...I still couldn't pass the auth test.

  1. Got an invitation form the Admin, on my work address - addr B. With admin rights, not only write.
  2. Trying to accept the invitation, I couldn't: my account already had access to the repository.
    Had to revoke my own access, just to be able to
  3. accept the admin rights.
  4. Pushed successfully via SSH:
$ hg push ssh://[email protected]/DB2UAdmin/repo
pushing to ssh://[email protected]/DB2UAdmin/repo
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 9664 changes to 9664 files
remote: bb/acl: mariusbutuc is allowed. accepted payload.

I still have no idea why pushing via HTTPS [username/password] failed!

Upvotes: 4

Related Questions