I’m about to wrap up a project with a client. I’m using github to store all of the files. He is naturally going to be making updates via the CMS, uploading new images, etc after I am off the project.
I am afraid that six months or a year from now if something breaks we will be in a bad place because it will be a full year or so of changes without any git commits (Again, this is a client. I don’t expect him to SSH in and run git commands.) I’m trying to set up a crontab job that will run hourly that will add everything, commit it, and push it to github. The problem I am running into is that it asks for my username and password and fails. How can I set it up so that my client’s server can push changes to the github repo without having to compromise my security?
Here is what I have so far.
0 * * * * cd ~/clientswebsite.com/; git add -u; git commit -m "Cron job"; git push --verbose > log.txt
You have a couple of options, but essentially, you have to start using SSH key authentication instead of username/password authentication.
The options depend on what, precisely, you’d like to identify using the key. For your case I’d say it’s either Deploy Key (which is bound to a machine) or a Machine User (which is bound to a specific user account, possibly across machines).
See this GitHub article for the details: https://help.github.com/articles/managing-deploy-keys