You can use Git Deploy Keys to avoid needing to remote onto servers, pull, enter creds and restart the server.

  1. Create your deploy keys in git (see https://help.github.com/articles/managing-deploy-keys)
  2. Add the key to your server
  3. Git clone/set remote for project via ssh
    • git clone git@github-project1:orgname/some_repository.git
  4. Write scripts to start/stop/pull your app
  5. Call the script remotely via ssh
    • ssh user@99.99.99.99 'source ~/.bash_profile;
      ~/user/myscript.sh'

Traps:

  • use user "git" in /.ssh/config for the host reference, otherwise github will reject requests
  • include 'source ~/.bash_profile' (or .bashrc, /etc/profile) in your script call to include environmental variables (ssh uses a very limited set by default)