SSH Permissions not working on CircleCI v2.0

ssh
git

#1

My CircleCI project checks-out from a GitHub repo (i.e. that’s what the build is linked to) and also checks out another repo from GitHub. I have configured a “machine key” for the other repo via SSH Permissions at the project level.

However, I receive the following error when git cloneing the secondary repo:

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

When I check which SSH key is being used to authenticate w/ GitHub, I see it’s the “deploy key” (which doesn’t have access to the secondary repo):

ssh -T git@github.com
Hi owner/repo! You've successfully authenticated, but GitHub does not provide shell access.

To fix this issue, I remove the “deploy key” during build startup:

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
ssh-add -d ~/.ssh/id_rsa.pub

Then I get the correct response:

ssh -T git@github.com
Hi machine-account! You've successfully authenticated, but GitHub does not provide shell access.

And my git clone works too :thumbsup:


This a nasty hack though! Is it possible to fix this?


SSH keys do not work after migrating to 2.0
SSH forwarding in a docker build context
#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.