diff --git a/src/Handler.php b/src/Handler.php
index b81ef21385a50deb884f85043848ad41b7025dc9..93a3f8045695358eae10c3c30a4212c1ab743b1c 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -80,7 +80,7 @@ class Handler extends BaseHandler {
       foreach (['contrib', 'custom'] as $subdir) {
         $path = $dir . '/' . $subdir;
         if ($subdir === 'contrib') {
-          $this->gitIgnore(str_replace('/drupal', '', $path));
+          $this->gitIgnore(str_replace('/drupal/', '', $path) . '/');
         }
         if (!$fs->exists($path)) {
           $fs->mkdir($path, 0775);