Host key verification failed during build config openshift

I want to clone private repo during image build config in Openshift, encountering below message while building, it says host key verification failed.

Cloning into 'project'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Removing intermediate container 89bd4c326e83
error: build error: The command '/bin/sh -c git clone ${PROJECT_GIT} project' returned a non-zero code: 128

Below are steps I followed to setup it up Created public and private key:

created secret in openshift

Pass the private key to openshift secret

IS-C02MW125Fxxx:bin tkmamgg$ ./oc secrets new-sshauth sshsecret --ssh-privatekey=$HOME/.ssh/id_rsa -n image-dev

Add the secret to service account builder

IS-C02MW125Fxxx:bin tkmamgg$ ./oc secrets add serviceaccount/builder secrets/sshsecret -n merch-do-sandbox-dev

IS-C02MW125Fxxx:bin tkmamgg$ ./oc get serviceaccount/builder -n image-dev
builder   3         136d

IS-C02MW125Fxxx:bin tkmamgg$ ./oc get bc/jmeter -n images-dev
NAME      TYPE      FROM         LATEST
jmeter    Docker    Dockerfile   75

update the build configuration:

IS-C02MW125Fxxx:bin tkmamgg$ ./oc patch buildConfig jmeter -p '{"spec":{"source":{"sourceSecret":{"name":"jmeter-ssh"}}}}' -n images-dev "jmeter" patched

That's how secret section in Build config file looks like:

      - secret:
          name: jmeter-ssh
      name: sshsecret
    type: Dockerfile
        - name: PROJECT_GIT
          value: ''

Worked around I followed after googling a bit:


Updated the hostname inside the known_hosts file

ssh-keyscan -H >> /home/jboss/.ssh/known_hosts

Tried to pass:

CMD ["sh","-c","git config core.sshCommand 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'"]


CMD ["sh","-c","echo 'StrictHostKeyChecking no' >> /home/jboss/.ssh/config"]

Please help me out what I am missing here...thanks