I have set it up so I auth with Github using ssh keys. I have tried everything out and it appears to be working. So now I want my app to run every time the computer boots so I create the following systemd config...
[Unit]
Description=Job that runs your user script
[Service]
WorkingDirectory=/.../web/site
ExecStart=npm start
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Again everything seems to work. Now I want to pull every time I boot before I start so I change to...
[Unit]
Description=Job that runs your user script
[Service]
WorkingDirectory=/.../web/site
ExecStart=git pull
ExecStart=npm start
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
But now it fails with...
Mar 08 05:45:21 debdev systemd[1]: Starting Job that runs your user script...
Mar 08 05:45:21 debdev git[731]: Host key verification failed.
Mar 08 05:45:21 debdev git[731]: fatal: Could not read from remote repository.
Mar 08 05:45:21 debdev git[731]: Please make sure you have the correct access rights
Mar 08 05:45:21 debdev git[731]: and the repository exists.
Mar 08 05:45:21 debdev systemd[1]: node-site.service: Main process exited, code=exited, status=1/FAILURE
Mar 08 05:45:21 debdev systemd[1]: node-site.service: Failed with result 'exit-code'.
Mar 08 05:45:21 debdev systemd[1]: Failed to start Job that runs your user script.
What am I missing? Is it because my SSH key is under my user? Can I make a "root" ssh key?