Search code examples
linuxgitupstart

Pull remote changes using git and upstart


I would like to pull the changes as user 'ubuntu' during startup.

The upstart file is:

description "Custom startup script"

start on filesystem

script
  cd /var/www/gitstuff
  git checkout master
  git pull
end script

When I rebooted I got this log message:

Already on 'master'
Host key verification failed.^M
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have a feeling when the upstart script runs it is being executed as root user.


Solution

  • Used this for the pull statement:

    git pull ubuntu@example.com:/etc/drupal/7/gitstuff
    

    Also had to add keys to the root user