Checkout fails with user-key (bitbucket)

My project has been building fine with the deploy key until I needed to add a submodule. Then it failed to clone submodules.

conq: repository access denied. deployment key is not associated with the requested repository.
fatal: Could not read from remote repository.

I followed the docs and added a user-key. After that it was unable to even pull the repository that I was building.

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
git command i returned 128: 

I’m using BitBucket and I also don’t see any SSH keys added from CircleCI in BB.

2 Likes

I’m hitting the exact same issue. Like eguven mentioned I couldn’t find the key being added anywhere in my BB account.

I ended up manually generating a keypair and adding the pubkey to my BB account and the privkey to circleci > project settings > ssh permissions for the host bitbucket.org

It’s a bit inconvenient.

I’m having the same problem. I’ve added a user-key to my CircleCI project but I don’t see any new public keys added to my BitBucket account.

I was having the same issue. It looks like Circle CI creates an ssh key but doesn’t submit it to Bitbucket.

I found a workaround although it feels very hacky. Open up the Chrome developer tools, and make sure you have “Log XMLHttpRequests” enabled. Then create a new user key. This will make a POST request to the Circle CI api. In the response to this API request there is a public ssh key. Copy this key and add it to your Bitbucket account as a new SSH key.

The build should work now.

5 Likes

thank you, it’s work

Hello,

Thank you for your report, this is currently a known issue until Bitbucket is able to provide us an API to create user keys. Here is a workaround in the interim.

From https://circleci.com/bb/<Your-Organization-ID>/<Your-Project-ID>/edit#checkout:

  1. Open Inspect Element in your browser’s developer tools.
  2. Click Create User Key
  3. Find the new public key generated in the Network tab.
  4. Go to your Bitbucket account and add it manually.

Let us know if this work around solves your problem, and feel free to reach out to support@circleci.com

Best,
@zzak

4 Likes

Here’s a screencast to show how to do this:

http://recordit.co/fTYmKQeBBO

The first part shows me adding a deploy key that gets automatically added to Bitbucket.

For the user key, that you’ll need if you want to check out other private projects that are dependencies of the initial project, you’ll need to use the trick shown to copy the public key we generate from the console and then paste it into your Bitbucket user settings.

This is required because Bitbucket doesn’t have an API that allows us to add user keys.

We’re working on a way to make it so that this hack is not necessary!

2 Likes