Connecting wordpress website with git lab

Is there any way I could connect this website code with gitlab so whenever I push it to gitlab, it automatically goes to my hosting, and an update is made on the website?

I haven’t looked at the code, but you should be able to install a tagged gitlab runner on that node, which does the deployment on your website server. You can add that tag to a deployment step in your pipeline.
Or you could add a script in cron that pulls the code from gitlab and maybe other required stuff for the deployment.
The first option is more the Gitlab way, so I think that is preferable, you could also add some tests in the pipeline, so the automatic deployment is only triggered when the tests succeed.
CI/CD pipelines | GitLab is a nice start to read up on pipelines and deployments.

Thank you @bartj
I will look into this and update.

If you have our own server that is hosting the website the options are limitless starting from your own GitLab Runner to scp files from GitLab to your server.

This is the reason why Git has become an integral part of the workflow for developers around the world.You should follow these steps:

Generate SSH key
Upload SSH key to the GitHub repository
Copy the SSH address of the repository
Deploy the application code from the repository

You can deploy WordPress applications on the Cloudways Platform very easily, “Deployment Via Git” feature that helps connect your Git repository with the Cloudways managed server

Nice feature, but does it depend on where you host your website, or is it build-in to wordpress?

Do you have access to FTP or SSH of the webhosting? Or do you just have access to WordPress Admin Panel?

Well, I just liked the feature, I’m not using wordpress at the moment (and if I would, I do have my own virtual server with a hosting company and ssh access and probably be able to set that up). So no need to go further into this, but thank you!

Ok, so to sum up, this is not a build-in wordpress feature. Wordpress is just a PHP app like any other, so you need a way how to copy it’s files to hosting server.

1 Like