0

I would like to set up an environment, where I push my code to a git and the code is deployed on the server right away. And to be honest I was wondering how that would work out? Let's say I have an Java project using Maven and some JSF included. Now I could build this to a WAR-File using Maven and push it into my tomcat, then restart the tomcat and it got deployed.

How does that work when it is pushed into a git? Is there some kind of module in the git included, where I can configure a directory where it should be build & pushed afterwards? Or is it just a certain branch that is pushed right away?

Rüdiger
  • 893
  • 5
  • 27
  • 56
  • 2
    The keyword you should google is probably "[git hooks](http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook/)" – lucidbrot Oct 12 '18 at 09:25
  • 1
    Possible duplicate of [Deploy a project using Git push](https://stackoverflow.com/questions/279169/deploy-a-project-using-git-push) – phd Oct 12 '18 at 12:04
  • https://stackoverflow.com/search?q=%5Bgit%5D+hook+to+deploy – phd Oct 12 '18 at 12:04

1 Answers1

2

Below mentioned link might be useful. Please check https://medium.com/@francoisromain/vps-deploy-with-git-fea605f1303b

  • Thank you, that helped! Just to clarify this idea for me: I write my own script that does the deployment for me. This is bound to a branch, right? That means that I can also work on a development branch and only deploy the code I push into my Master or also configure my git that way, that I have a Master Branch that deploys on the productive Server and another that could deploy onto a testing server? – Rüdiger Oct 12 '18 at 10:37
  • 2
    Thanks for writing an answer Bhanu. It would be way more useful for this website if you could write the relevant parts directly here, though (that prevents link-rot and makes it easier to get a quick answer) :) – lucidbrot Oct 12 '18 at 14:35