Git: How to manage a website with Git? How to use Git for a website -deployment?

半腔热情 提交于 2019-12-06 12:29:49

问题


Originally, I thought my problem was How to maintain branches in Apache's DocumentRoots? but realized the right question actually is How to use Git to deploy stuff to web -server such as Apache?.

I feel I have understood now the DocumentRoot -problem, it would require Apache hacking that I want to avoid because much simpler solution using side-effects and putting the repo outside the deployment -dir but now a problem to understand git-fetch-hook and how to deploy stuff if the outside thing is a large dir, perhaps just cp besides and then mv -- but there must be some better way of syncing the deployment -dir, thinking.

DocumentRoot -problem

DocumentRoots specify the dirs in httpd.conf for hostable material. Now in such folder, I want ticgit -branches and feature -branches. When I create branches in some DocumentRoot, I get master and the other branch mixed up. $ git checkout --orphan feature-0.01 is not empty but contains master -things. $ ti new ... creates a branch that has stuff from master, apparrently some bug in Ticgit (it works in small repos but creating ticgit -branch for larger repos like my DocumentRoot results into havoc). So how do you maintain your braches in Apache's DocumentRoot? Do you have your tickets there? What about your feature -branches? Look I am puzzled by this, $ git checkout feature-0.1 and now how does apache knows which files it should host? Things in master or things in feature-0.1?

My updated understanding of the DocumentRoot -problem

Now the problem with latter is that the deployment is not meant to work like this. I know SethRobertson's guide instructs some ways to use git for deployment. I think they are the best methods so far instead of hacking the Apache with git -repo inside the deployment -dir (commonly www).


回答1:


WRONG!

Do not develop inside your deployment -dir (commonly www in Apache). Develop elsewhere and use side-effects and proper version-control good-rules outlined in SethRobertson's guide here, particularly the rule about deployment branch for version 1.0 and tagging so you maintain a timeline how things develop over time. He states a do-not for the activity to mess development and deployment below, probably not good thing for your users also (they probably not wanting to see your editing of the website while browsing).

SethRobertson's guide states a DO-NOT for messing up deployment and development

use git as a web deployment tool

Yes it can be done in a sufficiently simple/non-critical environment with something like Abhijit Menon-Sen's document on using git to manage a web site to help, though there are other examples. However, this does not give you atomic updates, synchronized db updates, or other accouterments of an industrial deployment system.

So Using Git to manage a web site -tutorial here, example here and here -- but notice his warning "however, this does not give you atomic updates, synchronized db--".



来源:https://stackoverflow.com/questions/11360818/git-how-to-manage-a-website-with-git-how-to-use-git-for-a-website-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!