git仓库与不同位置的文件夹 [英] git repository with folders in different locations
问题描述
有没有人为此提供解决方案?
谢谢!
基本上有两种选择。您可以设置网络服务器,以便您想要的一个目录位于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屋!