Git, upload codes directly to the server

2

I wanted to know if a way to leave all my projects online is possible so I do not always modify my code to upload it to the server.

Go some questions:

  • Now with every update in the code I wanted to upload it directly to the server with the push (GIT), without having to manually upload to the server. Type github, but it does not interpret PHP code, just front-end, this is why I want to upload directly to the server.

I do not know if this is the best place to post this, but I hope so, thanks!

Update

I found a blog where the guy teaches, Link
I'll leave it open for anyone who wants to put their answer, but this question is duplicated, I do not know if I should delete it ?!

@egomesbrandao are you talking about this?

Mysolution

Myserverplanisfree,butitsupportsSSH,butinmyplan(free)itisdisabled.SoIwentonthislink "GitHub git-ftp" and did according to the documentation. Since my plan does not accept SSH I did it for FTP, but now I do not need to put FTP user and password every time I update, just do this (username and password) once and give a git push. This program is a bit slow, but automating the tasks already saves a great time!

Thanks for the answers!

    
asked by anonymous 04.03.2017 / 14:41

1 answer

3

No! Using branch for each environment is not the best alternative, this is called code promotion; and this technique is no longer used. The idea is to promote binaries or artifacts generated in a build process. As PHP is not a language that generates binaries, what you will promote are the artifacts that will basically be the same files, but with some quirks.

Imagine that you have a database connection string. In a good pipeline you would have a bank for each environment, so you would have to have a string for each one, it does not make sense to change the code for each environment. Then a tokenization process is used in the configuration file to replace the contents of the string for each environment that is deployed. This is just one of the techniques, so it's called the build and deploy process, there are several tasks that you will perform to complete this process.

Another practice would be, when pushing in the Git repository, trigger the whole process above, and not put a Git on the deploy server, it's even an anti-pattern to do that.

For all this pipeline automation there are tools like Trevis CI, Hudson, etc ...

    
05.03.2017 / 07:28