I would like to know how to build a project with private git submodules using IBM Bluemix Dev Ops Services.
In my pipelines, I have a 'Build' job with the type 'Shell Script':
#!/bin/bash
git submodule init
git submodule update --recursive
But my submodules include a number of private repositories, and I get:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
In my local machine, I am able to run those commands because I have access and I am using my key. What can I do to make it work here? I do not wish to commit my private key into git.
The repo for the app I am deploying is hosted on GitHub. And the private submodules are hosted on BitBucket.
Update
I tried to use my private key in the build console, but it did not work:
echo "... my private key ..." >> ~/.ssh/throwaway_key
chmod 400 ~/.ssh/throwaway_key
ssh-agent bash -c 'ssh-add ~/.ssh/throwaway_key; git submodule update --recursive'
Is it not working because I am inside a docker container? Do I have to update /etc/ssh/ssh_config
? I don't have access to this inside the container that this job runs in.
Update 2
I also tried without success:
echo "Host bitbucket.org
Hostname bitbucket.org
IdentityFile ~/.ssh/throwaway_key
IdentitiesOnly yes" >> ~/.ssh/config