diff --git a/drush/provision_git.drush.inc b/drush/provision_git.drush.inc
index 17a706d..ec27c12 100644
--- a/drush/provision_git.drush.inc
+++ b/drush/provision_git.drush.inc
@@ -455,7 +455,13 @@ function _provision_git_update_git_meta_data() {
       drush_set_option('repo_url', $repo_url);
     }
     if (drush_shell_cd_and_exec($repo_path, 'git describe --tags --exact-match || git symbolic-ref -q HEAD')) {
-      $git_ref = trim(str_replace('refs/heads/', '',drush_shell_exec_output()));;
+      $temp_git_ref =  str_replace('refs/heads/', '',drush_shell_exec_output());
+      
+      if(!empty($temp_git_ref) && is_string($temp_git_ref)) {
+        $temp_git_ref = trim($temp_git_ref);
+      }
+
+      $git_ref = $temp_git_ref;
       drush_set_option('git_ref', $git_ref);
     }
   }
