"Host key verification" error when accessing private Github repository

Issue

Deployments to Heroku fail with error messages about Host key verification, saying that its not possible to read from the remote repository.

Resolution

Often issues accessing private Github repositories will result in an error like this in your build log:

 	Host key verification 
	Could not read from remote repository.

Why am I getting a host key verification error?

Heroku does not have the private keys necessary to access your private Github repositories, and as such, attempts to access those private repos will fail.

Use OAuth tokens

Rather than providing Heroku with the private keys necessary to access your Github repo, its much better to use OAuth tokens.

Accessing Github from automated tools, scripts, etc - such as builds on Heroku - is precisely why GitHub created tokens. You can read more about creating GitHub access token here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support