对于在多个位置具有目录的项目使用GIT [英] Using GIT with projects that have directories in multiple locations
问题描述
我正在尝试将PHP / MySQL网络应用程序(基于CodeIgniter 2.01框架)移动到GIT存储库。问题是为了增加安全性我实现了分离应用程序部分(应用程序和系统文件夹)和Web文件(index.php,图像,css,js等文件夹)的最佳做法。网络文件位于/ var / www中,应用程序的位置位于/ data / company / apps / myapp。
I'm in the middle of trying to move a PHP/MySQL web app (built on CodeIgniter 2.01 framework) to a GIT repository. The problem is for added security I've implemented the best practice of separating the application part (application & system folders) and the web files (index.php, images, css, js, etc. folders). The web files are located in /var/www and the application stuff is located in /data/company/apps/myapp.
,我如何将有这样多个位置的项目迁移到GIT?
Since I would like to keep this added security, how do I migrate a project that has multiple locations like this into GIT?
推荐答案
我不认为你的结构Git存储库和部署的文件的结构需要匹配:
I don't think the structure of your Git repository and the structure of the deployed files need to match:
- code> post-receive hook例如)将文件从您的Git仓库复制到正确的系统路径(你单独SCM - 源控制管理 - 从RM - 发布管理)
- 或者直接将两个系统路径链接到Git仓库中的两个相关目录。
- either you add an extra step (
post-receive
hook for instance) copying the files from your Git repo to the right system paths (you separate SCM -- Source Control management -- from RM -- Release Management), - or you link directly your two system paths to the two relevant directories within your Git repo.
我在评论中添加:
如果您重新组织您的repo的内容,以具有相关内容的目录,两个
git archive
为每个目录,并提取它们在正确的地方。
if you reorganize your repo's content in order to have to directories with the relevant content, you can make two
git archive
for each directory, and extract them in the right places.
OP崩溃回复:
我在
post-update
中发现了以下命令的解决方案:
I found the solution with the following commands in
post-update
:
git archive --format=tar master:guts/ | \
tar -C /data/company/apps/myapp -x
git archive --format=tar master:skin/ | tar -C /var/www -x
这篇关于对于在多个位置具有目录的项目使用GIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!