Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a public key for ssh and registered that key with BitBucket. I then attempted to push:

$ hg push ssh://jhayward@bitbucket.org/johncharrell/[project name]
pushing to ssh://jhayward@bitbucket.org/johncharrell/[project name
running ssh jhayward@bitbucket.org "hg -R johncharrell/[project name serve --stdio"
remote: Warning: Permanently added the RSA host key for IP address '[server IP]' to the list of known hosts.
remote: Permission denied (publickey).
abort: no suitable response from remote hg!

What do I need to do so that my public key (or some other created for the purpose) will let me do an hg push from the shell or crontab? In BitBucket, I have read and write permissions to the project, but not to my knowledge anything administrative.

share|improve this question

closed as off-topic by jasonwryan, terdon, slm, goldilocks, devnull Apr 19 '14 at 17:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – jasonwryan, terdon, slm, goldilocks, devnull
If this question can be reworded to fit the rules in the help center, please edit the question.

The error Permission denied (publickey) basically means your public key is either missing from bitbucket or its somehow invalid. Try making a new .pub key with ssh-keygen and delete the old one referring to your host machine and register it. – user13742 Sep 14 '12 at 19:15
Are you sure you are using the correct URL format? Normally, it would be: ssh://hg@bitbucket.org/accountname/reponame/ – jasonwryan Sep 14 '12 at 19:42

To allow pushing, you should upload your public key to bitbucket you can do so with:

  • clicking your login icon at the top-right and selecting bitbucket settings
  • on the left in the section "SECURITY" select "SSH keys"
  • select "Add key" and upload your public key

After that you should be able to upload with any account that has the matching private key installed, even from a cron job.

I also recommend you create your repository first on bitbucket first then use the ssh parameter for hg provided by BitBucket to pull with mercurial. After that you can just do hg push without any parameters.

If you already have a repository, you have to do this in a new directory and copy your initial changes over the repository freshly checked out from BitBucket.

share|improve this answer
You can also fix the repository url in local copy's .hg/hgrc (section [paths], key default). – peterph May 9 '13 at 9:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.