How to use GIT and system update right after commit

Asked

Viewed 393 times

1

I am having a difficulty that I will illustrate to you: I’m starting to work with git right now and I don’t know much about it, but basic and intermediate commands are coming out. In my case, I have a whole system in MVC on a linux server on the network and I’m using git, but I would like that when the commit was finished the modification was already going to the files in the directory itself, like:

var/www/html/System

And git is like this:

var/www/html/System/. git/

So... I’m doing the commits and then grabbing there on the same FTP and pasting them in the folders, on the same arm.

I’d like a light on that. Thank you!

  • Who’s your github admin? The Server set up in your git account? Through it, you can do the pull request there

1 answer

4

There is a way through git , that is using hooks. In short you create a repository of the type bare, who will be responsible for receiving the commits and copy them into the production pulp.

In that repository type bare that is should be created on the server you create a hook (Git Hooks are scripts that run automatically each time you perform a 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 repository bare should be added as origin from your local workbook. So you can send the data via push to your server.

On linux it’s easy to do, this link can help you.

Deploy with Git - Configuring and running an automated deploy

  • I strongly recommend correcting Portuguese deviations and also putting an emphasis on foreign terms. Or by formatting code inline in git concepts, such as hook or Bare

  • 2

    It would also be a much more complete answer if you put how to make one hook in git, which I particularly only know exists, I don’t know how to make one. The idea is that the answers are complete, making Sopt a reference material on programming, extremely condensed and of great quality

  • 1

    Wow! really good! I managed to do this by following the steps of the site you went through. Thank you very much! I will use for all my private projects.

  • What a great @Guilhermepedrazzi! I started to collaborate little in stackoverflow and wanted to have created a much more complete answer to help you better. But I’m glad it all worked out. Then, if you can just make sure that the answer helped you (if that’s not how it works, rs ). !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.