Mr. B.
Mr. B.

Reputation: 8697

Git: how to unignore all Symfony vendor files?

unfortunately I can't use composer, due to low memory on the webspace. That's why I'm trying to push vendor/* to the git repository, to be able to pull the full project, including the dependencies.

In my .gitignore I'm forcing git to unignore the vendor files by !/vendor/*.

It works for most files, but not for /vendor/friendsofsymfony/jsrouting-bundle.

Content of /vendor/friendsofsymfony/jsrouting-bundle/.gitignore:

/phpunit.xml
/composer.lock
/composer.phar
/vendor/
/node_modules/

My repository is hosted at BitBucket. I don't know yet the meaning of the different folder-icon and the hashs next to it. If anyone knows, please comment.

enter image description here

Does anyone know how to force git to handle all the vendor files?

Thanks in advance!

Solutions
As the jsrouting-bundle is a git submodule, I chose this solution:

git submodule add git://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git vendor/friendsofsymfony/jsrouting-bundle

Another way would be to use the deps file (not tested), source: https://github.com/XKEYGmbH/ifresco-client/tree/master/vendor/friendsofsymfony/jsrouting-bundle/FOS/JsRoutingBundle/Resources/doc

Upvotes: 1

Views: 416

Answers (2)

COil
COil

Reputation: 7606

I had to do this in the past, here is what I did:

  • php composer.phar selfupdate
  • php composer.phar update
  • In the vendor directory run sudo find . -type d -name .git | xargs rm -rf
  • Commit all modifications: git add -A .

With this, your vendor will be commit like the src directory, so no need to run composer install when deploying in your production environment. When wanting to update just repeat the process. But of course it isn't a good practice and you should do this only if you can't run composer on your production server.

Upvotes: 1

Tom Verelst
Tom Verelst

Reputation: 15992

The jsrouting-bundle folder is a Git submodule. A Git submodule is actually a reference to another Git repository. This is why you cannot add changes from it to your original Git repository.

Upvotes: 2

Related Questions