I have some Codeigniter projects on some domains (on the same server), and the project is already in git.

How to ensure server gets the new update when I push the code to git?

Can anyone explain to me step by step?

  • What CI tool are you using?Please mention the all the tools you are using and if you are open to using other tools or not
    – KatariaA
    May 15 '19 at 5:33
  • Gitlab has the pipeline triggers. You could send a curl request to Jenkins to trigger a job there or Gitlab itself can deploy data with rsync or whatever you want. Both is done with the .gitlab-ci.yml file see here docs.gitlab.com/ee/ci/yaml/README.html
    – Michael D.
    May 16 '19 at 21:53

You can achieve this using Git and Jenkins job. Create a Jenkins Job to deploy your code to server and Setup Git webhook to Call Jenkins job.

Check this link: https://www.serverkaka.com/2019/02/configure-github-webhook-in-jenkins-job-pipeline.html


  1. Create an empty Git repo on the server

  2. Write a Git Hook to deploy the code

  3. Deploy from the local computer

Check this link: https://medium.com/@francoisromain/vps-deploy-with-git-fea605f1303b


Depens on how you hosting your application in production

  1. If non docker: use capistrano or other symlink deployment tool
  2. If docker: use docker swarm deploy to update your containers
  3. Then you need just add .gitlab-ci.yml file to your project directory and write some deployment scripts.

Git itself has a server-side post-receive hook. You can use it to run a command that triggers your deployment whenever you push to your repo. Web services like Gitlab or Bitbucket rely on this mechanism to offer plug-ins that trigger CI services. Less flexible but you can configure it conveniently from the web front end.

Another option would be to use a tool like Puppet on the target machine that periodically checks the repo for changes and pulls them in. The following Puppet code would clone/update the repo into the /path/to/repo directory (by default Puppet runs every 30 min):

vcsrepo { '/path/to/repo':
  ensure   => latest,
  provider => git,
  source   => 'git://example.com/repo.git',

See the documentation of the vcsrepo module for details.

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.