使用git和upstart拉远程更改

时间:2013-08-07 02:20:59

标签: linux git upstart

我想在启动时将更改作为用户'ubuntu'来提取。

upstart文件是:

description "Custom startup script"

start on filesystem

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

当我重新启动时,我收到了这条日志消息:

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.

我有一种感觉,当upstart脚本运行时,它正以root用户身份执行。

2 个答案:

答案 0 :(得分:0)

尝试:

脚本

cd /var/www/gitstuff
su - ubuntu git checkout master
su - ubuntu git pull

结束脚本

答案 1 :(得分:0)

用于拉语句:

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

还必须向root用户添加密钥