简体   繁体   English

在Git上共享宅基流浪者盒子和laravel项目

[英]Share homestead vagrant box and laravel project on Git

On my local machine I have created using homestead vagrant box a laravel project. 在我的本地计算机上,我使用宅基地游民箱创建了一个laravel项目。 Now I have an Homestead folder that contains many files like Vagrantfile, Homestead.yaml configuration and as soon as. 现在,我有了一个Homestead文件夹,其中包含许多文件,例如Vagrantfile,Homestead.yaml配置以及第一个文件。 I have also another folder sibling of Homestead folder that contain the Laravel files project. 我还有Homestead文件夹的另一个文件夹兄弟,其中包含Laravel文件项目。 My question is how to share on Git this folders in order to clone the repository from another machine and recreate automatically the same Vagrant machine and the laravel project? 我的问题是如何在Git上共享此文件夹,以便从另一台机器克隆存储库并自动重新创建同一台Vagrant机器和laravel项目? In both folders there are composer.json files.Thanks in advance. 两个文件夹中都有composer.json文件。

Depends on what you want to achieve. 取决于您要实现的目标。 If you want to have a "frozen" in time vagrant box you would init homestead, let it do it's thing and them remove anything that's not mentioned in the vagrant file, then use that as a base for your repo. 如果您想拥有一个“冻结”的时间流浪者盒子,您可以启动宅基地,让它做这件事,然后他们删除流浪者文件中未提及的任何内容,然后将其用作您的回购协议的基础。 You can also fork homestead, run init and the use that as a base. 您还可以派发宅基,运行init并将其用作基础。

Homestead has an extra provisioning script, by convention named after.sh (see this for an example and this to see when it's called), which could clone your project from a separate repo into a place of your choosing (consistent with the project root you set up in your homestead file). 家园有一个额外的配置脚本,按照惯例命名after.sh (见的示例和看的时候,它被称为),这可以从一个单独的回购克隆你的项目到一个地方你选择的(与项目根一致您在您的宅基地文件中设置)。

My point is -- don't mix development environment setup with your project files. 我的意思是-不要将开发环境设置与项目文件混在一起。

All of the above could be done under assumption you would have all the prerequisite software installed on your machine (vagrant, homestead, git, etc). 假设您已经在计算机上安装了所有必备软件(vagrant,homestead,git等),就可以完成上述所有操作。 Otherwise (maybe homestead would do it for you) you might also right a custom setup script that would check those dependencies, attempt to install them and the up the homestead box based on your configuration (something like a pre-init to init.sh :)). 否则(也许homestead会为您完成此操作),您还可以init.sh一个自定义安装脚本,该脚本将检查这些依赖项,尝试根据您的配置安装它们并在homestead框内up (类似于init.sh的pre-init: ))。 Or just put the instructions in the readme file (or link to Laravel's documentation ). 或者只是将说明放在自述文件中(或链接到Laravel的文档 )。

I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM