"Host key verification" error when accessing private Github repository

Issue

Deployments to Heroku fail with error messages like Host key verification. Could not read from 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.

This is because Heroku does not have the private keys necessary to access your private Github repositories, thus attempts to access those private repos will fail.

Rather than providing Heroku with the private keys necessary to access your GitHub repo, it's 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