How to set proper checkout permissions when using a Github Deploy Key generated by CircleCI?

I have a private repository that uses a dynamic CircleCI configuration to build specific modules depending on which application was modified. Once the correct workflow runs, the checkout step is failing with a permissions denied error. I have already generated a Deploy Key for my project in the SSH Keys settings page.

I was expecting that generating the Deploy Key would automagically give the CircleCI job access to my repo.

First question that comes to mind is if the project/repo shows up in your Projects list? If not, you will need to follow it first. If it does, then you will need to go into the Project Settings and choose “Stop Building”

Then you will have to refollow the project.

Thanks for taking a look!

It was showing in my projects list, so I stopped building it and re-followed. I am still seeing the same error.

Just to confirm, maybe a few silly questions - has this worked with other projects? or is it the only project that’s failing?

Are you trying to checkout a different git repo or just the same repo as your project?

There are a few various reasons why an auth might fail - trying to refresh permissions and/or reauthenticate CircleCI might help too:

@zmarkan Thanks for taking a look too!

has this worked with other projects? or is it the only project that’s failing?

It’s the only project I have tried a dynamic configuration on.

Are you trying to checkout a different git repo or just the same repo as your project?

I am trying to checkout the same repo as my project.


I tried the recommendations from the two threads that you linked. Now I am getting a similar, but different error:

Using SSH Config Dir '/home/circleci/.ssh'
git version 2.38.2
Cloning git repository
Cloning into '.'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

What additional information from my side would be useful to debug?