0

I'm developing a Laravel project with 2 teammates. We need to use Git so we can, from time to time, download our teammates's work and run it.

Problem is: Some files differ (and they have to), for example, bootstrap.php (or start.php, I don't recall), which contains the hostname (is different for every computer). vendor/ differs too. Therefore, these changes should never be committed.

I imagine, however, that there is one good solution that will work for any Laravel project. We added vendor/ to .gitignore, but I think we messed up when we used "git add ." to then commit, adding the files to the staging area.

How do you guys that have been through this issue solved this problem?

1 Answer 1

2

The only reference I could find to hostname was in bootstrap/start.php and all that is doing is using a hostname to detect the environment, which later dictates which configuration files to use.

Check out http://laravel.com/docs/4.2/configuration#environment-configuration

Basically what I did was in start.php, I have something like

$env = $app->detectEnvironment(array(
    'production' => array('PRODUCTION-MACHINE-NAME'),
));

Then I created a subdirectory under config called production and placed all the configurations which production will use in that directory and Laravel handles the rest.

The .gitignore file which came with Laravel should be fine and /vendor should be included in there. Composer will handle that directory.

Sign up to request clarification or add additional context in comments.

3 Comments

So, we basically stick with Laravel's gitignore and that'll be all? I believe the problem I was having was due to some mistakes when using git commands (like git add .) , having the 'ignored' files committed
you can remove the vendor folder from the git index use "git rm" then commit. never run composer update (composer install onlt) as it will update packages to the latest versions.(depending on the configuration on the composer.json) also add cache and log folders to the ignore file. you dont wanna share them
git rm --cached, otherwise you'll remove it from your FS... haha

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.