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 git@github.com:aspin/private.git
Cloning into 'private'...
The authenticity of host 'github.com (192.30.253.112)' 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 'github.com,192.30.253.113' (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?