How do I use the GIT and system to update right after the commit

1

I am having a difficulty that I will exemplify for you: I'm starting to work with git now and I do not know much about it, but basic commands and intermediates are coming out. In my case, I have an entire system in MVC on a linux server on the network and I'm using git, but I would like it when the commit is finished the modification would already go to the files in the directory itself, type:

  

var / www / html / System

And git is like this:

  

var / www / html / System / .git /

So ... I'm doing the commits and then picking up on the same FTP and pasting them into the folders, on the same arm.

I would like a light on it. Thank you!

    
asked by anonymous 17.10.2017 / 22:33

1 answer

3

There is a way through git , which is using hooks . In short, you create a repository of type bare , which will be responsible for receiving commits and copying them to the production folder.

In this repository of type bare that is to be created on the server you create a hook (Git hooks are scripts that run automatically every time you perform some particular action in the Git repository). In your case, the action will be to copy the files to production every time the repository receives a push .

This bare pository should be added as origin of your local workbook. So you can send the data via push to your server.

In Linux, this link can help you.

Deploy with Git - Configuring and running an automated deploy

    
17.10.2017 / 23:13