How to run git pull and bypass SSH passphrase prompt in user startup script?

This is on Ubuntu, I have a user startup shell script that runs every time the instance boots (EC2 via --user-data-file argument). I want to have the instance do a git pull from a specific branch every time it boots. The problem is when I do a git pull, there is a SSH key passphrase prompt and I am not sure what the best way is to automatically enter the password in a shell script.

  • using git post-receive for overwriting files in multiple directories
  • .ssh config with amazon ec2 and git
  • error: waitpid for C:\Program Files (x86)\PuTTY\plink.exe failed: No child processes
  • Is it possible to do a Git Pull from Amazon Web Services?
  • Git post-receive hook not running following push
  • Why is EC2 not pulling updates from bitbucket/github via post-receive hook?
  • Git with 2 developers
  • Docker git clone on container launch?
  • .git/info/exclude replacement for git submodule?
  • "Clone in Mac' fails on GitHub. Takes me to download page every time
  • How to build project from Github? Instructions inconclusive
  • Only allow 'git push heroku master' from the master branch
  • 2 Solutions collect form web for “How to run git pull and bypass SSH passphrase prompt in user startup script?”

    Try Expect
    it will allow you to provide password to interactive ssh session

    You should generate your public ssh key and ask the administrator of that branch to store the key in his authorized_keys file.

    This is what you should do:
    Generating Your SSH Public Key

    This is what the administrator should do:
    How to Use RSA Key for SSH Authentication

    Git Baby is a git and github fan, let's start git clone.