Permission Denied when trying to push to a private repository Edited

Hi All,

I go the following error when I was trying to push:

stamaki@~/repos/dplpwithdp$ hg push 
pushing to
abort: Permission denied

I haven't get this issue before. What cause it? Usually shouldn't it ask me password before proceed to check permission?


I tried to look into ~/.hgrc and ~/repos/dplpwithdp/.hg/hgrc, they all don't seems suspicious, only my usename/email address are in the first one and only the repo location are in the second one...

I also tried to search for the error on line, all metions ssh key. But I'm not using ssh and I haven't even had an ssh key setup, and before today all the push seems to be working normally without the ssh key setup.


Update: now I realize even a simple command to clone a public repo would fail:

stamaki@~/temp$ hg clone
abort: Permission denied
stamaki@~/temp$ hg clone
abort: Permission denied


Update 2: my ~/.hgrc:

# example user config (see "hg help config" for more info)
# name and email, e.g.
# username = Jane Doe <>
username = Tamaki_Sakura <>
verbose = True

# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
# pager =
# progress =
# color =


Update 3: I realize this issue seems to be still related to bitbucket somehow.

I couldn't clone the public repository rpy2 from Bitbucket, but I could clone the public repository GUN Health from Savannah:

stamaki@~/temp$ hg clone
abort: Permission denied
stamaki@~/temp$ hg clone
destination directory: health
requesting all changes
adding changesets
adding manifests
adding file changes


3 answers

1 accepted

0 votes
Answer accepted

I still don't know the way to solve this problem, but it can be bypassed. 


If I stop using HTTPS protocals and stick with SSH protocals, and do the SSH key setup & change all my hgrc from https to ssh & modify my ~/.hgrc, I was able to use mecurial to clone any public repo on bitbuckit & push changes to my private repo.


Well, although it was hard to set up the SSH protocals, at least it has the benefit that I don't have to input my password each time. So I guess I will just stick with it. 

Jim Redmond Atlassian Team Jul 27, 2017

If SSH is working but HTTPS isn't, then I'd suspect something about a proxy server or firewall preventing access from that system to port 443. Do you have anything like that in place?

That I don't know - the linux computer I use is actually the login node of a cluster owned by my University, so I don't have any access to its firewall settings. Although I wouldn't be surprise if my instuition set up some weird rules in the firewalls that prevent access to Bitbucket's Port 443. I could talk them through, but it doesn't seems like the IT deaprtment is super intersted in chaging the firewall rules if I could bypass it by using some other protocals. 

Jim Redmond Atlassian Team Jul 27, 2017

In that case SSH sounds like your best bet.

1 vote

Hi Sakura,

Have you tried pushing to any other repo within your same Bitbucket account? Are you getting this error for all of them?

Regarding not being prompted for your credentials, do you remember if you have saved them ti your ~/.hgrc file? The [auth] section in your ~/.hgrc file contains credentials for HTTP authentication.

bb.prefix =
bb.username = {username}
bb.password = {password}

If you saved them there, then you won't be prompted everytime you push.

What version of Mercurial are you using?



Thank you for your response, it seems to happen at other repo also, even for those that I have set for public access and are open to public and I am only doing clone.


Although I was able to pull from another public repo using another computer, so I think it might be a mercurial software issue on the computer I am currently using.


My credentials is not saived in any of the hgrc file.


The mecurial I use is 3.8.3, it does seems fairly old. I could try to update it to see if this would make any difference, but I doubt so, because the other computer that work actually use 2.8.2....

ok changing to 4.2.2 don't work.....

1 vote

Hi Sakura! You said that you tried cloning one of your public repositories and it failed and you also said that when you used a different computer, and in that case it worked. I have tried cloning that public repository myself (rpy2), and it has worked. 

This looks like it could be a local issue in your computer, so my recommendation would be to wipe the SourceTree preferences. If you're still unable to pull or clone after that, make sure you have the latest SourceTree version from our website.

However, you mentioned that you're also having trouble when cloning from the command line, so I'm afraid this issue is caused by something else. In any case, please let us know which SourceTree version and OS are you using.


Lastly, keep in mind that the repo rpy2 belongs to a team account, as it's public anyone can clone it but for private repos you'll need to have access to the team.

Keep me updated, Sakura.

Best regards,


Thank you very much for your response.

I'm not using I have to? Since I am using linux, I thought the mecurial command line is enough.

I could try to see if any preference in mercurial may cause the problem but since my ~/.hgrc only have my username in it I am not sure if there is much I could do...

The operating system where I had problem cloning rpy2 is openSUSE Leap 42.2. The different computer that worked is running Ubuntu 14.04 LTS.

Hi Sakura, you don't need to use SourceTree, for some reason I thought you were already using it and that's why I recommended the previous steps.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

280 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you