Git clone fails in Circle 2.0

build-image
circle.yml
config

#1

I’m trying to migrate one of my builds to 2.0.

The build has a clone step of an external (and private) repository that contains some infra code for the build to execute.

Original circle.yml is working just fine:

dependencies:
  pre:
    - git clone git@github.com:OrgName/Repo.git ~/RepoLocation

In the new config.yml, I tried to do the same:


steps:
- run:
name: Download HSConfiguration
command: git clone git@github.com:Org/RepoName.git ~/RepoLocation

But for some reason I get a host unknown interactive command:

#!/bin/bash -eo pipefail
git clone git@github.com:Org/RepoName.git ~/RepoLocation

Cloning into ‘/home/circleci/RepoLocation’…
The authenticity of host ‘github.com (192.30.253.113)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? Step was canceled

Anyone has any thoughts about it?


#2

To work around that I added the following command:

  - run:
      name: Avoid hosts unknown for github
      command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config

Just before the clone command itself.


#3

Hello @AvnerCohen,

This is happening when trying to clone a separate private repo from within the build?

Could you send me a build link? DM is also fine.

Also, have you added a user key to your project that has access to the repo?


#4

This is 3 month old…

The issue is around “StrictHostKeyChecking no” , and yes, when I clone a
seperate repo from the one being built.

The first access to a certain github IP gives that warning.


#5

I’m also seeing this issue in the same scenario


#6

We also are seeing this. Only on first run I’m guessing.

We are even adding machine account key, but still getting the prompt to accept github’s RSA

#!/bin/bash -eo pipefail
bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching git@github.com:-----/-----.git
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:-----.
Are you sure you want to continue connecting (yes/no)? Too long with no output (exceeded 10m0s)

#7

Those are two different things. Just running - checkout will add the key to ~/.ssh/known_hosts like you need. Or you can copy the necessary snippet from a given checkout command in the UI.


#8

Running - checkout in a workflow triggered by a tag fails.
Do you have any advice within this context?


#9

Are you restoring a source cache? Try removing that if you are.


#10

I am running into the same issue. The workaround suggestion worked for me.

- run: 
          command: |
            mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
            git clone -b develop $CIRCLE_REPOSITORY_URL 
            cd $CIRCLE_PROJECT_REPONAME