RuntimeException: Could not delete docroot/core/.git/ ...

Posted by alexmoreno on Thu, 31/05/2018 - 21:44
First sign of something going wrong, you do a composer update and get this in the middle:
 
  [RuntimeException]

  Could not delete docroot/core/.git/hooks/applypatch-msg.sample:
You can get different messages, core path, whatever. Important to notice is that the process (composer) has been suddenly interrupted. Worst thing is that, after this, you just get:
  [RuntimeException]

  Source directory docroot/core has unpushed changes on the current branch:

  Branch master could not be found on the origin remote and appears to be unpushed
after you try any composer update or install, so you are blocked.
[email protected]:/var/www/vecfullmig$ rm -rf docroot/core/.git/

rm: cannot remove /docroot/core/.git/info/exclude Permission denied

...

Solution is simple, just check what you have in that folder (docroot/core). Its just generated code via composer, so you are good to remove it:
[email protected]:/var/www/vecfullmig$ exit

logout

Connection to 127.0.0.1 closed.

[email protected]:~/projects/personal/vec/vecd8-fullmigration/vecfullmig$ rm -rf docroot/core/

[email protected]:~/projects/personal/vec/vecd8-fullmigration/vecfullmig$ composer update

    1/2:    http://packagist.org/p/provider-latest$d62e317bf7d5968846ee2c0b922c14df60b0c1ca3ae7f714b5e2cb0a1afd1ace.json

    2/2:    http://packagist.org/p/provider-2018-04$f7d80ec02ae656c3d18ff3dedb552ff63a2f728f4ec718d15443f45741f8ab23.json

    Finished: success: 2, skipped: 0, failure: 0, total: 2

Gathering patches for root package.

Removing package drupal/entity_browser so that it can be re-installed and re-patched.

  - Removing drupal/entity_browser (2.0.0-alpha2)

Deleting docroot/modules/contrib/entity_browser - deleted

Removing package drupal/entity_embed so that it can be re-installed and re-patched.

  - Removing drupal/entity_embed (1.0.0-beta2)

Deleting docroot/modules/contrib/entity_embed - deleted

Removing package drupal/media_entity_instagram so that it can be re-installed and re-patched.

But it's still resisting itself. Leave the vm, remove it from the host and all good to continue:

[email protected]:/var/www/vecfullmig$ exit

logout

Connection to 127.0.0.1 closed.

[email protected]:~/projects/personal/vec/vecd8-fullmigration/vecfullmig$ rm -rf docroot/core/

[email protected]:~/projects/personal/vec/vecd8-fullmigration/vecfullmig$ composer update

    1/2:    http://packagist.org/p/provider-latest$d62e317bf7d5968846ee2c0b922c14df60b0c1ca3ae7f714b5e2cb0a1afd1ace.json

    2/2:    http://packagist.org/p/provider-2018-04$f7d80ec02ae656c3d18ff3dedb552ff63a2f728f4ec718d15443f45741f8ab23.json

    Finished: success: 2, skipped: 0, failure: 0, total: 2

Gathering patches for root package.

Removing package drupal/entity_browser so that it can be re-installed and re-patched.

  - Removing drupal/entity_browser (2.0.0-alpha2)

Deleting docroot/modules/contrib/entity_browser - deleted

Removing package drupal/entity_embed so that it can be re-installed and re-patched.

  - Removing drupal/entity_embed (1.0.0-beta2)

Deleting docroot/modules/contrib/entity_embed - deleted

Removing package drupal/media_entity_instagram so that it can be re-installed and re-patched.

Happy days :-)

categorias: