How does gitignore work while deploying it to a server?

Hello,

Recently I took over a project that has been in the works for a while. And, I switched over to automated deployments using AWS. Codecommit, CodePipeline, and CodeDeploy to get the application onto a development server.

This all works out pretty good except I noticed that some of the .gitignores are actually ignoring some important files such as:

frontend/web/.gitignore


/index.php

/index-test.php

backend/web/.gitignore


/index.php

/index-test.php

And many other .gitignores throughout the project’s source.

Now, I dont know if this is due some type of programming issue(other person caused some weird issue) that I came into, or if there is some reason why this is set up like this. As you can imagine, the page is no longer working as our git is not getting the index.php’s which means its not being deployed on to the server.

Is there any further documentation I should be reading before doing anything else? I have read anything with the "-local" prefix SHOULD NOT BE USED ON THE SERVERS, and I am trying to understand why? And why even have them then? I can understand if they are there for local development inside a closed network at a company, but we are using a public facing development system that has very tight security(IP white-listing) for testing out the site live.

So… yeah thanks! B)

short version run the yii init script if you already know what that is otherwise read below.

the reason why you see the following files in gitignore is because when you developing, your paths might be different then your production servers instead of manually updating every path yii provides a init script which will generate the files with correct paths.

here is a link to the documentation

UPDATE: btw there are plans for removing init scripts in future version of yii because its causing lot of confusion for beginners

Thank you.

Im assuming I have to run this for a development server, and a live server. Is it safe to run this in a project that has never had it run before? And do you only run it once? How can I know if its been run before or not?

Also, it seems like we have a index.php, and a default.php inside our root folder. I downloaded the advanced template, and it seems like those are not there … is this normal? Or is this some type of hack someone did? :-X

EDIT:

I downloaded the template, and did the init, im on windows 10, so I used php70. However, I could not get yii.bat to work at all…




PHP Core Warning 'yii\base\ErrorException' with message 'Module 'pdo_mysql' already loaded'


in .\Unknown:0


Stack trace:

#0 [internal function]: yii\base\ErrorHandler->handleFatalError()

#1 {main}

Press any key to continue . . .

After downloading the template, and running the init, I noticed that the frontend/backend files are still being ignored. I have the following questions that need to be answered:

1: Should I be changing the frontend/backened /web/.gitignore to allow index.php, and index-local.php to allow them to be found for source control?

2: What other .gitignore should I be changing?

And my final number 3 question. Why is there different development environments? Now it seems almost impossible to merge a git branch into master(live) without MAJOR conflicts …

I think well stick with a "Production" environment, and just have our own custom class that can set development or live settings. That way we can always have a clean merge into master from a branch/feature.