code: function(cb) {
              git(repoDir, ['status'], function(err, stdout, stderr) {
                  if (err) {
                      log.warn('git status failed on ' + repoDir + ":", err.msg);
                      var indexFile = path.join(repoDir, '.git', 'index');
                      path.exists(indexFile, function(exists) {
                          if (exists) {
                              fs.unlink(indexFile, function(err) {
                                  if (err) {
                                      log.warn('removing file ' + indexFile + ' failed with:', err);
                                  }
                                  else {
                                      log.info('removed index file: ' + indexFile);
                                  }
                                  cb(err, {status: {stdout: stdout, stderr: stderr}, removeIndex: 'remove git index ' + indexFile + ', result ' + err});
                              });
                              return;
                          }
                          log.warn('No index file ' + indexFile);
                          cb(err, {status: {stdout: stdout, stderr: stderr}, removeIndex: 'no index present'});
                      });
                      return;
                  }
                  cb(null, {status: {stdout: stdout, stderr: stderr}});
              });
          }
docs: Remove git index if it appears corrupted