15

Config:

  • CircleCI 2.0
  • Bitbucket private repo

After I click on "Rebuild with SSH", the "Enable SSH" section outputs

Failed to enable SSH No SSH key is found. Please make sure you've added at least one SSH key in your VCS account.

What does this mean? How do I fix this?

Carson Ip
  • 1,896
  • 17
  • 27

2 Answers2

7

You can use your personal private public id_rsa id_rsa.pub key-pair (which you may already generated to SSH access to other machines)

just add your public key ~./ssh/id_rsa.pub to Bitbucket -> Settings -> SSH keys -> add SSH key

then go to CircleCI and rebuild the project.


There may be confusion because CircleCi uses other SSH key called checkout SSH key-pair for:

  • checking out the main project
  • checking out any Bitbucket-hosted submodules
  • checking out any Bitbucket-hosted private dependencies
  • automatic git merging/tagging/etc.

Private checkout SSH key is saved on circleCi servers and public key is automatically uploaded to Bitbucket.

Jirik
  • 1,435
  • 11
  • 18
  • 2
    I added SSH key to my bitbucket account (not repo), but I still get "Failed to enable SSH" in CircleCI – Carson Ip Mar 25 '19 at 10:04
  • @CarsonIp It worked before, but now I think the problem on their side (CircleCI and Bitbucket APIs): https://discuss.circleci.com/t/debug-with-ssh-has-stopped-working-in-bitbucket/27949 – Jirik Mar 25 '19 at 10:49
  • thanks for the link! I asked the question in 2017 and I still haven't had the luck to use the SSH feature in 2019. I'll be waiting for updates in the CircleCI discussion thread. – Carson Ip Mar 25 '19 at 16:38
  • 1
    From CircleCI support: "Thank you for your patience while we have investigated this issue. A change has been made to the Bitbucket API to tighten security that was not compatible with how we previously handled SSH keys for BitBucket users. We are currently in communications with the team over at BitBucket to discuss potential resolutions for this issue. We are unable to provide an ETA at this time but will do our best to provide updated information when possible." – Carson Ip Mar 26 '19 at 04:29
  • 1
    The issue has been fixed on 8 Apr 2019. This answer is right. But if you have a team, you must add the SSH key under the personal account instead of the team. – Carson Ip Apr 24 '19 at 07:42
  • @CarsonIp you should post that comment as an answer, I've been trying to fix this for ages and this is the only place I can find on the internet that mentions it should be on your personal user not on your team. – Shardj Nov 26 '19 at 12:28
  • 1
    @Shardj right. I was stuck for a long time too. Adding a TLDR to this accepted answer. – Carson Ip Nov 27 '19 at 03:35
2

If you're using Github:

You should immediately be able to log in with SSH into the CircleCI now (run rerun job with SSH).

If you're using Bitbucket:

  • Add your public key to your bitbucket account: choose Bitbucket settings from your avatar in the lower left
  • Click ssh keys and add your public key
  • You don't need to do anything in CircleCI, simply re-run the job using SSH

sources:

michelepatrassi
  • 2,016
  • 18
  • 32