diff --git a/Utils.php b/Utils.php
index 34c5d0b94d0e89e59cfc99188f381b3c416da873..845f68d9d833dda9ef87302d1bbf2351c75e2a88 100644
--- a/Utils.php
+++ b/Utils.php
@@ -179,10 +179,20 @@ final class Utils {
     return $this;
   }
 
+  /**
+   * Make sure that git init was called.
+   */
+  protected static function gitInit() {
+    if (!file_exists('.git')) {
+      passthru(escapeshellcmd('git init'));
+    }
+  }
+
   /**
    * @param string $command
    */
   public static function git($command) {
+    self::gitInit();
     passthru(escapeshellcmd('git -c "user.email=composer@lakedrops.com" ' . $command));
   }
 
@@ -212,6 +222,7 @@ final class Utils {
    */
   public static function gitLFS($pattern) {
     if (self::$lfsGitPatterns === NULL) {
+      self::gitInit();
       $output = [];
       exec('git lfs track', $output);
       self::$lfsGitPatterns = implode(PHP_EOL, $output);