Troubleshoot "The authenticity of host 'github.com' can't be established" message during job execution.

Problem:

You may encounter the message "The authenticity of host 'github.com (<ip>)' can't be established" during a workflow. As CircleCI cannot authenticate the host the job may fail with the message "Too long with no output (exceeded XmYs): context deadline exceeded". This can also apply to other VCS providers such as GitLab or BitBucket, in these cases the domain will be replaced with their respective domains.

Solutions:

  • Add the default 'checkout' step to your job

    • CircleCI will automatically populate known hosts when the default 'checkout' step is included.
  • Or add a custom step at the beginning of the job.

    • - run:
        name: Populate known hosts
        command: |
          mkdir -p ~/.ssh
          ssh-keyscan "<vcs_domain>" >> ~/.ssh/known_hosts
    • <vcs_domain> should be replaced with the base domain of your provider, i.e. "github.com".

Outcome:

The ~/.ssh/known_hosts file will now be populated with your VCS provider's keys so they can be correctly authenticated during connection attempts.

Additional Notes:

The solutions above can be used together, in this case the custom 'run' step should be added before 'checkout'.

Additional Resources:

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.