Trying to use AWS Amplify to deploy a multi-repo dendron wiki which has a mix of public and private github repositories.
Amplify can be associated with a single repo but there doesn't seem to be a built-in way to pull in additional private repositories.
CodePudding user response:
- Create a custom deploy key for the private repo in github
- generate the key
ssh-keygen -f deploy_key -N ""
- Encode the deploy key as a base64 encoded env variable for amplitude
cat deploy_key | base64 | tr -d \\n
- add this as a hosting environment variable (eg. DEPLOY_KEY)
- Modify the
amplify.yml
file to make use of the deploy key- there's 2 key steps
- adding deploy key to
ssh-agent
- WARNING: this implementation will print the
$DEPLOY_KEY
tostdout
- WARNING: this implementation will print the
- disabling
StrictHostKeyChecking
- NOTE: amplify does not have a
$HOME/.ssh
folder by default so you'll need to create one as part of the deployment process
- NOTE: amplify does not have a
- adding deploy key to
- relevant excerpt below
- ... - eval "$(ssh-agent -s)" - ssh-add <(echo "$DEPLOY_KEY" | base64 -d) - echo "disable strict host key check" - mkdir ~/.ssh - touch ~/.ssh/config - 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - ...
- full build file here
- there's 2 key steps
Now you should be able to use git to clone the private repo.
For a more detailed writeup as well as alternatives and gotchas, see here