Git does not like underscores

1.5k Views Asked by At

I am trying to push a project that has a folder with an underscore in the name. It is a BigCommerce Hello World app that uses "realityking/hash_equals": "dev-master". The dependency is in 'vendor\realityking\hash_equals'. When I push the project, then clone it, the hash_equals folder is empty. When I run git rm -r * to delete the repository from Heroku, I get an error.

error: the following file has staged content different from both the file and the HEAD: vendor/realityking/hashequals (use -f to force removal)

I tried everything to delete it but I could not. I deleted the app, created a new one, deleted .git locally, started over, and I get the same problem.

Obviously, I should not use underscores in folder or file names, but this is an existing "Hello World" project that has been proven to work.

Is there a way to fix this?

1

There are 1 best solutions below

0
On BEST ANSWER

Heroku uses 'composer.json' and 'composer.lock' to restore the vendor directory each time you deploy. This means the vendor directory should not be committed in Git.

If you commit those two files, Heroku's PHP buildpack restores packages using Composer.

The directory is empty when you clone the repository because you must use Composer to restore them. Use the command php composer.phar install to re-populate your vendor directory.

To remove the hash_equals directory from your repository, use the command git rm -fr vendor/realityking/hash_equals, then commit.