I’ve setup Git to manage our code. Say server ‘live-server’ is our production server with ‘project.git’ as a bare repository. Everyone pushes to that ‘project.git’ and when all the testing is done – what is the proper way to move from project.git to web root directory on our live-server? I saw examples using hooks – are there any better alternatives? Is there any standard?
Your help is appreciated.
There is no standard, but a
post-updatehook which:cdinto the destination (“prod” or “live”) directorygit pullfrom the bare repo (project.git)is enoughMake sure to specify the
--git-dirparameter though in your hook, or the git pull will fail.See “Git – post-receive hook with git pull “Failed to find a valid git directory”” for the details.