Cloning Private Github repos with Circle Local CLI

I’ve seen a couple of posts about this (e.g. How can I clone a github private repository at local cli?) but no answers.

I’m trying to use the CLI locally, but all of my clones of private repos besides the main one are failing. Example output:

  #!/bin/bash -eo pipefail
cd ~/ws
git clone -b develop --single-branch --depth=1

Cloning into 'private'...
The authenticity of host ' (' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?

Naturally, I can’t respond to this since it’s just output, not an interactive shell. So I disabled StrictHostChecking and now I get the real error – Circle Local CLI (or the docker image?) doesn’t have an SSH key to use to find the repo.

Warning: Permanently added ',' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

In actual CircleCI, we solved this by adding a SSH key in the config of the repo – what do we do with the local CLI?

1 Like

Can you share the full command that you are running?

It’s quite literally git clone -b develop --single-branch --depth=1

Sorry I mean, when you start the circlecli, you may need to pass in a key inside.

I don’t pass any keys explicitly. Doesn’t Circle detect and pull your SSH key automatically? It cloned the repo in the checkout: block perfectly ok and that’s a private repo with the same access credentials as the ones that don’t succeed. I looked briefly at --checkout-key but that seems only for the checkout repo.

The line I ran is something like this though: circleci build --job test-repo -c .circleci/config.yml.2 (config.yml.2 because my actual config was in 2.1 and I did a sed to a second file)

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