Skip to main content

Setting up Git Version Control

Comments

3 comments

  • cPanelAdamF
    You're missing one step and then you're good to go: We don't automatically create a commit for the files you've already got in the /public_html/versiontesting folder. If you'd like the files you already have in the /public_html/versiontesting folder to be tracked by the git repo you created there, you'll have to ssh in and do a "git add .; git commit" to get them checked in. Once that's done, you can return to your fork on your laptop there and do a "git pull" to bring down those files. The other thing to consider is that we don't typically suggest that your git repo itself exist inside the document root of your domain. You can totally do it if you want to, but, in general, it's better to have it live somewhere else and then use our
    0
  • Stephen Price
    Thank you for the reply. If I follow your advice and use a remote repository, does that also get updated when I do a push? If there are multiple people working on a job then the main repo needs to be updated, not just the files located in the document root of the domain.
    0
  • cPanelAdamF
    Yes, though it's important that you keep this model in mind for it to work best:
    • /home/zencart/repositories/yourproject - This is the location of your git repository (NOTE: Not inside the public_html folder)
    • Inside your project, ask your developers to create a .cpanel.yml file which performs the deployment tasks necessary to deploy your website. Give them Guide to Git - Deployment - cPanel Knowledge Base - cPanel Documentation because it fully explains the whole deployment process.
    • Your team will need to know that your website is hosted in /home/zencart/public_html/versiontesting. The deployment tasks will need to write into /home/zencart/public_html/versiontesting.
    You've described that more than one person will work on the project. They'll need the 'Clone URL' from the Git Version Control feature for your repository and you'll need to authorize their SSH Keys to give them access to pull and push to it. (Use SSH Access - Version 76 Documentation - cPanel Documentation to set that up for them.) Once that's set up, you and your team will need to agree to use one specific git branch only for deployment. Then, you should set that branch as the "active branch" in your cPanel account. When they're ready to publish their work, they should "merge" their work into that branch and then do a git push to push those changes up to your account. When the changes arrive, cPanel will recognize that new work has arrived on the "active branch" and perform the deployment tasks they put in your .cpanel.yml
    0

Please sign in to leave a comment.