1

I've been motivated to start using GitHub because a potential employer wants to see my source code, but I'm finding the process of committing the files manually from my computer after downloading them to be a bit inefficient. Is it possible to have git running on my VPS to periodically or by command push select directories to a git repository?

I'm running WHM 11.52.2 on CentOS 6.7.

Alternatively, can anyone recommend a decent workflow for keeping live, local and remote backups in sync (without having multiple local copies)?

  • This is not something that is built into cPanel, you would have to do it via SSH i.e a cron job that goes a git push daily. – Simon Hayter Jan 20 '16 at 17:03
  • @SimonHayter Actually git is built into cPanel as of version 11.36 (my version is 11.52.2.4). So I know it would be executed by a cron job or something similar, but what to put in it I have no idea. – Bobe Jan 20 '16 at 17:33
  • @SimonHayter Sorry I may have misinterpreted your comment about it being built as referring to git rather than the functionality, and it's too late to edit it. :| – Bobe Jan 20 '16 at 17:40
1

The solution is to put everything on your website into git. Modify the files locally on your home machine. When you are ready to publish, push them to github and push them to your website over ssh. Here is a tutorial that walks you through cloning your git repository over SSH: https://www.siteground.com/tutorials/siteground-git/clone-git-repository.htm

The only caveat is that if you have sensitive data (like passwords) in any of your code, you will need to remove them before moving everything to git. I usually store passwords in configuration files outside of the git repository and have the code read them from a known location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.