Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • python 2.7.1+
  • mercurial 1.7.5
  • on Ubuntu 11.04
like image 698
Marius Butuc Avatar asked Sep 19 '11 18:09

Marius Butuc


2 Answers

  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!

like image 54
Marius Butuc Avatar answered Sep 22 '22 03:09

Marius Butuc


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.

like image 25
Simon Francesco Avatar answered Sep 24 '22 03:09

Simon Francesco