Home > OS >  SSH clone/push to Bitbucket Forbidden
SSH clone/push to Bitbucket Forbidden

Time:01-25

When I clone through ssh, I have the error like this:

Forbidden fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I have followed up a few tutorials. The pub key is added to my account in personal settings => security => SSH keys

There is a trouble shooting page. I loaded the key by using

ssh-add

If I run

ssh -T [email protected]  

I got

authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled

This response doesn't fit to any cases, it doesn't show pubkey errors, etc. The closest case, which is the correct response is:

authenticated via ssh key.
"conq: logged in as username."
You can use git to connect to Bitbucket. Shell access is disabled

The "" part is missing in my case.

That is why I can't find a solution through other posts.

My port 22 is not blocked, I can ssh to my server or other places well. I am doing this at home, there isn't any extra firewall. I can ssh clone on Github using keys.

Update:

I removed the key in Bitbucket and tried to add the same key. It shows a duplication error:

Someone has already added that SSH key.

After removed the key, I tried the ssh command again, it shows

authenticated via ssh key.

Theoretically, there exists no duplicated keys. If I added this key, no one else can add it again. When I remove it, this key shouldn't exist in their database anymore, so that the ssh command should gives invalid pubkey error and there shouldn't be a duplication error when I tried to add it agin.

I really feel there is a bug on my account on Bitbucket, but I really believe this can happen.

CodePudding user response:

My port 22 is not blocked, I can ssh to my server or other places well.

At work, I can also ssh to other servers within the enterprise LAN (Local Area Network).

But I would most certainly not be able to SSH to any internet-facing servers.

Assuming this is not the case here, it can depend on your OS, SSH version and SSH key.

Try with a new key: ssh-keygen -P "" -t rsa -f ~/.ssh/testbb, and register testbb.pub to your account.

Add a ~/.ssh/config file with:

Host bb
  Hostname bitbucket.org
  User git
  IdentityFile ~/.ssh/testbb

And test it with ssh -Tv bb.

CodePudding user response:

If you get following response via ssh -T bitbucket.org, you're good to go:

authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled

On my machine I'm getting the same answer. I'm not sure where you got the information that this reply should contain your user name, but it's not true.

Just try it out with, for example:

git clone [email protected]:atlassian/ssh-run.git
  •  Tags:  
  • Related