I have a docker container, and inside this docker container I have a shell script which performs a git clone from a private repo. The script is as follows:
eval $(ssh-agent) > /dev/null
# add the ssh key
ssh-add /root/.ssh/id_rsa
kill $SSH_AGENT_PID
git clone ssh://git@bitbucket.org/project/repo.git
but when docker is running it gives an error
Cloning into 'repo'...
Host key verification failed.
fatal: Could not read from remote repository.
When I test on my local machine, I can clone the repo without a failure, so I know there is nothing wrong with my ssh keys.