eas build -p ios --profile preview --local), but the cloud build has no authorization to read my github repo.
I tried to add my ssh private key to the secret, then to add this eas-pre-install-hook without success:
mkdir -p ~/.ssh
echo "$PRIVATE_SSH" > ~/.ssh/id_ed25519_eas
chmod 0600 ~/.ssh/id_ed25519_eas
# add your git provider to the list of known hosts
echo "** known_hosts ** "
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "** ssh-agent ** "
any idea how to add a ssh key to get access to my private github repo from EAS build ?
What you’ve done looks reasonable and similar to the example here:
The first thing that comes to mind (although I doubt it is a problem) is that the example is using a Base64-encoded SSH key and decodes it while writing it to file.
I see you’re using an SSH agent instead of relying on SSH finding your key automatically. I suspect that’s the problem. You’re starting the ssh-agent, but when this shell script exits, the environment variables pointing at the agent disappear and the later invocation of SSH won’t know how to connect to the agent.
So I think you’d have two ways of dealing with this.
- Write the key to one of the filenames that SSH tries by default. I suspect if you rename it to
~/.ssh/id_ed25519 (i.e. remove the “_eas” off the end) it will work.
- Alternatively, also create a
~/.ssh/config file containing something like this:
Indeed the config file works well for my needs!
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.