On Tue, 19 Nov 2013 13:50:49 -0800 (PST) lesssugar <rgozdzial...@gmail.com> wrote:
> OK - question. I created the remote repo based on your instructions. > I now have: > > repo at */var/www/repos/app.git* > applicaton files at */var/www/app* > > I cloned the repo to my local machine via SSH. I did a minor change > and eventually pushed the modified file to the repo - with success - > however the file in my application folder did not change. How do I > synchronize the repo (app.git) with my actual application? I would > like to see the changes LIVE after I push them. It worked this way > with Mercurial: there was a remote repo and a local cloned version - > after performing push the changes were instanlty in the remote. > > How do I do this with Git? For some reason you've decided to skip the part of my reply dealing with this: >>> The solution to (1) is to use a so-called "bare" repository on the >>> server (this kind of repository does not contain the work tree) >>> armed with a post-receive hook -- a script which is run by Git >>> when certain event happens in the repository, reception of new >>> commits in our case -- performing actual update of files in a >>> dedicated directory using the latest (received) state of some >>> branch. >>> >>> Now I'll stop here and let you google for "git+web+deployment" for >>> this topic has accumulated countless blog posts by now. In more words: 1) A bare repository used for deployment is usually armed with a post-receive or post-update hook which is a script making sure a directory containing a "live" application to be updated is brought to reflect the required state -- usually the tip commit of a branch updated by pushing. This is usually done using something like export GIT_DIR=/path/to/the/bare/git/repo.git export GIT_INDEX=`mktemp /var/tmp/git_indexXXXXXX` trap "rm -f '$GIT_INDEX'" INT TERM QUIT EXIT cd /path/to/the/app git checkout -f refs/heads/master git clean -fdx 2) If you also need to perform database schema upgrades etc you'll possibly need a more involved solution. 3) Just freaking google it, as I have asked -- there are literally tons of blog posts and HOWTOs, even including specific approaches such as updating wordpress-based sites etc. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.