Answers: <p>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. </p>
  
  <p>Check this link: <a href="https://www.serverkaka.com/2019/02/configure-github-webhook-in-jenkins-job-pipeline.html" rel="nofollow noreferrer">https://www.serverkaka.com/2019/02/configure-github-webhook-in-jenkins-job-pipeline.html</a></p>
  
  <blockquote>
    <p>OR</p>
  </blockquote>
  
  <ol>
  <li><p>Create an empty Git repo on the server</p></li>
  <li><p>Write a Git Hook to deploy the code</p></li>
  <li><p>Deploy from the local computer</p></li>
  </ol>
  
  <p>Check this link: <a href="https://medium.com/@francoisromain/vps-deploy-with-git-fea605f1303b" rel="nofollow noreferrer">https://medium.com/@francoisromain/vps-deploy-with-git-fea605f1303b</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-06-20T09:05:35.377Z
Answers: 2019-06-20T09:05:35.377Z
Answers: Subhash
Answers: <p>Git itself has a server-side <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="nofollow noreferrer"><code>post-receive</code> hook</a>. 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.</p>
  
  <hr>
  
  <p>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 <code>/path/to/repo</code> directory (by default Puppet runs every 30 min):</p>
  
  <pre><code>vcsrepo { '/path/to/repo':
    ensure   =&gt; latest,
    provider =&gt; git,
    source   =&gt; 'git://example.com/repo.git',
  }
  </code></pre>
  
  <p>See the <a href="https://forge.puppet.com/puppetlabs/vcsrepo" rel="nofollow noreferrer">documentation of the vcsrepo module</a> for details.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-21T05:24:21.313Z
Answers: 2019-05-21T05:24:21.313Z
Answers: Martin Konrad
Answers: <p>Depens on how you hosting your application in production</p>
  
  <ol>
  <li>If non docker: use <a href="https://capistranorb.com" rel="nofollow noreferrer">capistrano</a> or other symlink deployment tool</li>
  <li>If docker: use <code>docker swarm deploy</code> to update your containers</li>
  <li>Then you need just add <a href="https://docs.gitlab.com/ee/ci/quick_start/#creating-a-gitlab-ciyml-file" rel="nofollow noreferrer">.gitlab-ci.yml</a> file to your project directory and write some deployment scripts.</li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-19T06:29:38.470Z
Answers: 2019-05-19T06:29:38.470Z
Answers: Vasiliy  Shakhunov
Body: <p>I have some Codeigniter projects on some domains (on the same server), and the project is already in git. </p>
  
  <p>How to ensure server gets the new update when I push the code to git?  </p>
  
  <p>Can anyone explain to me step by step?</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-05-15T05:33:26.623Z
Comments: 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
Comments: KatariaA
Comments: CC BY-SA 4.0
Comments: 2019-05-16T21:53:10.870Z
Comments: 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 https://docs.gitlab.com/ee/ci/yaml/README.html
Comments: Michael D.
Tags: <git><gitlab><continuous-deployment><continuous-delivery><cicd>
Title: Auto Deploy after push to git
UserDisplayName: Roby Firnando Yusuf
ThreadText: # Auto Deploy after push to git
  
  (Asked by: username_0 on 2019-05-15)
  
  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?
  
  **Tags:** git, gitlab, continuous-deployment, continuous-delivery, cicd
  
  > **Comments:**
  > **username_1**: 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  
  > **username_2**: 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 https://docs.gitlab.com/ee/ci/yaml/README.html  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2019-06-20. Score: 1 | Accepted answer
  
  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>
  
  > OR
  
  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>
  
  
  ---
  
  ### Answer by username_4 on 2019-05-21. Score: 0
  
  Git itself has a server-side [`post-receive` hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). 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](https://forge.puppet.com/puppetlabs/vcsrepo) for details.
  
  
  ---
  
  ### Answer by username_5 on 2019-05-19. Score: 0
  
  Depens on how you hosting your application in production
  
  1. If non docker: use [capistrano](https://capistranorb.com) 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](https://docs.gitlab.com/ee/ci/quick_start/#creating-a-gitlab-ciyml-file) file to your project directory and write some deployment scripts.
  
  
  ---
  
  