Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SSH Access - Permission denied (publickey).

Using VSCode (running in a linux container), I am able to push changes to my bitbucket account using HTTPS, but not SSH, as I get the following... Permission denied (publickey).

fatal: Could not read from remote repository.

AFAICT I have configured it correctly, but looking on-line, the documentation states that the format of the clone URL's should be...

HTTPS: https://<repo_owner><accountname>/<reponame>.git


However, when I login in to my bitbucket account and go to my project, the clone address for SSH is in the format<accountname>/<reponame>.git, which is not correct.

I have tried using git remote set-url origin to set the URL, and running, git remote -v does show the correct details, but the details in my project on my bitbucket account still shows the wrong address.

I think? this is the cause of my problem, but unless I can change it, I won't know for sure.

How do I change this URL?

1 answer

1 accepted

0 votes
Answer accepted

Hi @ron w and welcome to the community.

Regarding the clone URLs, these should be:

HTTPS: https://<username><workspace-id>/<repo-slug>.git


where <username> is the username of your Bitbucket account that you are authenticating with
and <workspace-id> is the Id of the workspace that owns the repo

I'm not sure what documentation you were checking, would you mind posting the link here so I can take a look, in case something is wrong in the doc?

You mentioned:

However, when I login in to my bitbucket account and go to my project, the clone address for SSH is in the format<accountname>/<reponame>.git, which is not correct.

Do you get this clone address from Bitbucket website, if you log in, open the repo, and from it Source page select the link Clone?

If so, the URL listed there should be the correct one and should use the workspace-id.
The workspace-id should also be visible in the address bar of your browser, while you are viewing this repo, e.g.<workspace-id>/<repo-slug>/src/master/


1. My first suggestion here would be to change the URL of the repo to<workspace-id>/<repo-slug>.git as I explained above, in case it is not already like that.


2. Afterwards, attempt to push from VSCode.


3. If you still get the same error, I would suggest navigating to the repo directory from a command line tool, and try to push from command line. This is to understand whether the issue may be specific to VSCode or not.


4. If this fails as well, I would like to ask if you could try the push, again from command line, with the following flags:

GIT_SSH_COMMAND="ssh -vvv" <git push command>

and copy-paste the output here so we can take a look.

(Please make sure to sanitise any sensitive info from the output, e.g. usernames, workspace-ids or repo names, prior to posting it here).

The command above will give verbose output and quite possibly an indication of what may be going wrong.

Please feel free to let me know if you have any questions.

Kind regards,

Hi Theodora,

Thank you very much for your answer :-) It turns out that both you and the bitbucket site both had the correct information, and not the other various sources that I found on-line.

I didn't get the information from the bitbucket site, but from another site. I would post the URL, but I deleted all the pages about 20 minutes ago (just before I read your reply!) in jubilation of finally fixing the issue, after 12 hours!!!

The solution to the problem was two-fold...

1) When using the bitbucket/jira extension in VSCode, the SSH key MUST be called id_rsa.

2) The SSH key MUST NOT have a passshrase.

If the rules above are not adhered to, then push, pull, etc, will work from the VSCode terminal (as I just found out), but not from the menu items!



Hi Theodora,

Actually, I just found that page with the mis-information that I mentioned, and it was actually a bitbucket site. The URL is here...



Hi Ron,

I'm glad that you managed to resolve the issue, and thanks for sharing the solution!

Thank you so much also for providing the URL of the doc, I will bring this up with the team responsible for the documentation, as I believe the URLs listed there need to be fixed.

If you need anything further, please feel free to reach out!

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

226 views 2 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you