Answer the question
In order to leave comments, you need to log in
Git. Remote server
There is a web project. In which editing is carried out constantly, and, in principle, not hot. How to steer all this through git so that you can track the history. I re-read a large number of articles, but there is usually from a local machine to a remote one. And how can you immediately see your edits in production?
Answer the question
In order to leave comments, you need to log in
How we do it:
There is a repository on a certain server.
Developers work with local copies of the repository (which is logical and correct).
Another local copy of this repository is the document-root for the site.
When developers do a git push, a miracle happens, because git can hooks, which are in [gituserhomedir]/repositories/[reponame]/hooks. And by adding a couple of lines to the hook called post-commit, a simple script is launched. In our case, it looks like this:
But, in principle, anything can be stuffed into this script.
If the site is not on the same server as the central repository, then all this needs to be wrapped in ssh, of course.
#!/bin/bash
cd /var/www-data/some_site
git checkout master
git pull
Those. you need only for one local machine? Then everything is simple - create a folder, go into it and use git init to create a repository and that's it ... you do all the commit while in the same folder. You no longer need git push and git pull because you won't have remote branches.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question