Host Key Verification Failed" Error with External Modules

Last updated: November 10, 2024

Issue: Error Downloading Git-Based Modules

Error Message:

error downloading 'ssh://git@github.com/ 
Host key verification failed. 
fatal: Could not read from remote repository error

This error occurs when Spacelift attempts to retrieve a Git-based module but cannot authenticate with the remote repository. This guide explains how to configure Spacelift with the necessary credentials to access private repositories.

Solution

To access private repositories, Terraform retrieves Git-based modules via HTTPS or SSH. If your repository is private, you’ll need to provide Spacelift with credentials for access.

  1. Set Up Access Credentials
    Follow the steps outlined in the Spacelift documentation on using external modules to configure access to private Git repositories.

  2. For SSH-Based Access

    • If you are using SSH for access, the SSH key must be named id_ed25519 to be recognized by Spacelift.

    • Ensure the key is correctly configured and has the necessary permissions for the repository.