The authenticity of github host can't be stablished

With my current Circle CI config, I get this warning prompt (which freezes the job):

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

In order to fix it, I use the following workaround:

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

Documented here

However I was wondering if any one found a more cleaner solution for this problem.

I’ve already tried the following:

Below my Circle CI config:

version: 2

defaults: &defaults
  working_directory: ~/repo
    - image: circleci/node:latest

    <<: *defaults
      - checkout
      - restore_cache:
            - v1-dependencies-{{ checksum "package.json" }}
            - v1-dependencies-
      - run: yarn install
      - save_cache:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - persist_to_workspace:
          root: ~/repo
          paths: .
      - run: yarn test
      - run: yarn chromatic test --exit-zero-on-changes
    <<: *defaults
      - attach_workspace:
          at: ~/repo
      - run:
          name: Avoid hosts unknown for github
          command: mkdir ~/.ssh/ && echo -e "Host\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
      - run:
          name: Install Now CLI
          command: sudo npm install --global --unsafe-perm now
      - run:
          name: Authenticate with registry
          command: echo "//$NPM_TOKEN" > ~/repo/.npmrc
      - run:
          name: deploy
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
                  npm run release && now --token $ZEIT_TOKEN --prod 
                  now --token $ZEIT_TOKEN
  version: 2
      - test:
              only: /^v.*/
      - deploy:
            - test

Basically it fails executing the npm run release script, which requires push permissions to upload the git tags.

If you’re going to use deploy keys, which is what you’re trying to do now, you need to use the - add-ssh-keys step to inject the keys.

For pushing back to GitHub though, a user key is best:

Your first suggestion makes sense, but I’ve already tried it without success:

  • I have the user key in the project settings in Circle CI
  • That user key created by Circle CI has read/write permissions in github
  • I use the following add_ssh_key config for the deploy job:
    <<: *defaults
      - attach_workspace:
          at: ~/repo
      - add_ssh_keys:
            - <fingerprint>

However the job still freezes and shows the same warning prompt as before.

I don’t think I can do the recommended user key method since I cannot access via SSH to Zeit servers in order to create a machine user there, as detailed here

@amalv Did you ever figure this problem out? I haven’t found a single CircleCI official response to this problem. I also don’t like the notion of disabling strict key checking. Thanks!

This only began happening the past day or so but I ran into this issue while installing Ruby gems from github on port 443.

This isn’t the best way to do this since if someone is spoofing GitHub this could be dangerous but since I’m only doing sandbox testing I’m not so concerned.

I added this command before my bundle install
ssh-keyscan -p 443 >> ~/.ssh/known_hosts