Hey, I am currently trying to configure a build hook which install dependencies via npm install
.
As such, I have a handful of private dependencies that we are currently having trouble installing.
I have checked out the documentation below but the guidelines on how to achieve this are minimal.
https://docs.platform.sh/development/private-repository.html#using-multiple-private-git-repositories
Currently, I have a GitHub machine account which has access to the private repos. This account has the same SSH key attached on both GitHub and Platformsh.
Still no luck with this current setup, is there something I am missing?
Thanks.
Did you ever solve this? I ran into a very similar issue; except it was working for one project, and it wasn’t after creating a second project. I needed to copy the project deploy key as an “SSH Key” on the machine user GitHub account Settings > SSH and GPG keys
page.
Well, this is over 2 years old.
@mango-chutney I couldn’t even figure out how to do it. I can set up a machine user on GitHub, and give the machine user access to a few repos, but then I need to make the private key available to my platform.sh project so it can use it when running git clone in a build pipeline, or even just getting submodules.
How did you make the machine user ssh private key available to the platform.sh project?
FWIW, I ended up solving this; wish it were documented. I created a machine user, created an ssh keypair, affiliated the public key with the machine user, saved the private key as a base64-encoded sensitive project-level variable, and then used it in my build steps. This does not work for git submodules, so I had to do some manual git clone
steps:
export CUSTOM_SSH_KEYFILE=$HOME/.ssh/id_ed25519
if [ ! -f "${CUSTOM_SSH_KEYFILE}" ]; then
mkdir -p ~/.ssh
chmod 0700 ~/.ssh
echo -n ${GITHUB_PRIVATE_KEY} | base64 -d > ${CUSTOM_SSH_KEYFILE}
chmod 0600 ${CUSTOM_SSH_KEYFILE}
fi
GIT_SSH_COMMAND="ssh -i ${CUSTOM_SSH_KEYFILE}" git clone git@github.com:org/repo.git targetdir
1 Like