symfony / symfony

The Symfony PHP framework
https://symfony.com
MIT License
29.72k stars 9.45k forks source link

Symfony3 gitignore prevents project from initialized #16963

Closed lashae closed 8 years ago

lashae commented 8 years ago

A new project generated in Symfony3 via the Symfony installer generates the following .gitignorefile:

/app/config/parameters.yml
/bin/
/build/
/composer.phar
/vendor/
/web/bundles/
/var/
!var/cache/.gitkeep
!var/logs/.gitkeep
!var/sessions/.gitkeep
/phpunit.xml

If I add this code into a Git repository by executing following snippets:

lashae@Sinan:~/dummy/deneme$ git init
Initialized empty Git repository in /Users/lashae/dummy/deneme/.git/
lashae@Sinan:~/dummy/deneme$ git add --all
lashae@Sinan:~/dummy/deneme$ git commit -m "Initial Commit"
[master (root-commit) b8fbaf3] Initial Commit
 31 files changed, 2848 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 README.md
 create mode 100644 app/.htaccess
 create mode 100644 app/AppCache.php
 create mode 100644 app/AppKernel.php
 create mode 100644 app/Resources/views/base.html.twig
 create mode 100644 app/Resources/views/default/index.html.twig
 create mode 100644 app/autoload.php
 create mode 100644 app/config/config.yml
 create mode 100644 app/config/config_dev.yml
 create mode 100644 app/config/config_prod.yml
 create mode 100644 app/config/config_test.yml
 create mode 100644 app/config/parameters.yml.dist
 create mode 100644 app/config/routing.yml
 create mode 100644 app/config/routing_dev.yml
 create mode 100644 app/config/security.yml
 create mode 100644 app/config/services.yml
 create mode 100644 composer.json
 create mode 100644 composer.lock
 create mode 100644 phpunit.xml.dist
 create mode 100644 src/.htaccess
 create mode 100644 src/AppBundle/AppBundle.php
 create mode 100644 src/AppBundle/Controller/DefaultController.php
 create mode 100644 tests/AppBundle/Controller/DefaultControllerTest.php
 create mode 100644 web/.htaccess
 create mode 100644 web/app.php
 create mode 100644 web/app_dev.php
 create mode 100644 web/apple-touch-icon.png
 create mode 100644 web/config.php
 create mode 100644 web/favicon.ico
 create mode 100644 web/robots.txt
lashae@Sinan:~/dummy/deneme$ git remote add origin https://lashae@git.mycompany.com/scm/sf3/test.git
lashae@Sinan:~/dummy/deneme$ git push -u origin master

And clone it to other location:

lashae@Sinan:~/dummy/deneme-validation$ git clone https://lashae@git.mycompany.com/scm/sf3/test.git
Cloning into 'test'...
remote: Counting objects: 44, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 44 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (44/44), done.
Checking connectivity... done.

And try to initialize it with composer install however I get the error at the end:

lashae@Sinan:~/dummy/deneme-validation/test$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing doctrine/lexer (v1.0.1)
    Loading from cache
...
...
...

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command:  
  Could not open input file: app/console              

I suppose this is not intended result, am I doing something wrong or shouldn't symfony ignore /bin/console?

Hanmac commented 8 years ago

i think something else is wrong because it does look for "app/console" but the file is in "bin/console", maybe something with Sensio DistributionBundle is broken

stof commented 8 years ago

There was a bug in the symfony-installer currently, which does not keep the right gitignore file for Symfony 3. It has been fixed in the 1.5 release of the installer: https://github.com/symfony/symfony-installer/pull/218 To fix existing projects, copy the gitignore file from the symfony-standard repo and re-add the bin/console file to your git repo

javiereguiluz commented 8 years ago

@lashae and don't forget to update your Installer executing symfony self-update

lashae commented 8 years ago

@stof @javiereguiluz Thanks my issue is resolved.