When "Only build with pull requests" is set, repository clone fails



We have a pretty standard set up, builds are running on every push to the Gitgub repo, as expected.

I’ve gone to the project settings page, advanced settings, and set “Only build pull requests” to “on”.

Now, Circle shows each new push as “Not run”, as expected, because it should only run tests for pull requests.

However, when I do make a pull request, the build fails because Circle gets this error message:

Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.

ERROR: Repository not found.
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: 

Can anyone cast any light on this issue please?


We’re also seeing this problem since enabling “Only build pull requests” a couple of days ago.

Creating a pull request fails as @g105b mentioned.
Pushing a new commit to the branch, causes it to build correctly.




Glad it’s not just me - this kind of issue drives me barmy when there is no obvious cause and is hard to debug.

Watching eagerly for a response.



Thanks for reporting this. We’re currently investigating the cause of this behaviour.

As a workaround, can you add a ‘user deploy key’ instead of a ‘project deploy key’ to the affected project. An explanation of what this means and how to do it is on the ‘Project settings > Checkout SSH keys’ screen.

As stated on that page: “Your best bet, for fine-grained access to more than one repo, is to create what GitHub calls a machine user. Give this user exactly the permissions your build requires, and then associate its user key with your project on CircleCI.”


I can confirm that this is a bug on our end. A fix should be available soon.

In the meantime the workaround above will get your projects building (although I realise it’s a bit of work to create the GitHub machine user and set it up appropriately).


Thank you so much for your patience. We have fixed this issue. Please reach out to us if you are still facing problems.