git仓库与不同位置的文件夹 [英] git repository with folders in different locations

查看:171
本文介绍了git仓库与不同位置的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个拥有三个文件夹的git仓库。这对我的本地Web服务器来说很好。然而,在实时服务器上,这些文件夹中的两个需要放在webroot后面,其中一个需要放在webroot中 。我想在服务器上使用git repo轻松推/拉,但这些文件夹需要在不同的地方使用。



有没有人为此提供解决方案?



谢谢!

解决方案

基本上有两种选择。您可以设置网络服务器,以便您想要的一个目录位于webroot中(通过符号链接并允许遵循符号链接,或者通过适当设置文档根目录),或者让一些外部进程将其复制。



对于后者,您可以有一个简单的复制cron作业,或者一个稍微复杂的git commit hook来完成复制。如果您使用了像 rsync 之类的东西,那么您只会复制实际已更改的东西。您当然可以采取这种做法,并有一个完整的持续集成系统,在运行测试后,将文件复制到正确的位置。


So I have a git repository that hold three folders. This is fine for my local web server. However, up on the live server, two of these folders need to be behind the webroot and one of them needs be in the webroot. I'd like to use a git repo on the server for easy pushing/pulling, but the folders need to go in different places.

Does anyone have a solution for this?

Thanks!

解决方案

You basically have two options. You can either set up the webserver so that the one directory you want is in the webroot (by symlinking and allowing to follow symlinks, or by setting the document root appropriately) or have some external process copy them.

For the latter, you could have a simple copy cron job, or a slightly more sophisticated git commit hook that does the copying. If you used something like rsync, you would only copy things that have actually changed as well. You could of course take this approach further and have a full blown continuous integration system which, after running tests, copies the files into the correct place.

这篇关于git仓库与不同位置的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆