            globals.processUtils,
            _workingDirectory,
          );
-@@ -326,7 +326,7 @@ class FlutterVersion {
+@@ -298,7 +298,7 @@ class FlutterVersion {
    /// the branch name will be returned as `'[user-branch]'`.
    String getBranchName({ bool redactUnknownBranches = false }) {
      _branch ??= () {

       if (parseResult.exitCode == 0) {
         buffer.writeln('Channel "${getNameForChannel(channel)}" was previously on: ${parseResult.stdout}.');
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index f2068a6ca2..99b161689e 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -106,7 +106,7 @@ class FlutterVersion {
     String? channel = _channel;
     if (channel == null) {
       final String gitChannel = _runGit(
-        'git rev-parse --abbrev-ref --symbolic @{u}',
+        'git --git-dir .git rev-parse --abbrev-ref --symbolic @{u}',
         globals.processUtils,
         _workingDirectory,
       );
@@ -114,7 +114,7 @@ class FlutterVersion {
       if (slash != -1) {
         final String remote = gitChannel.substring(0, slash);
         _repositoryUrl = _runGit(

 
     // Check first for a stable tag
     final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$');
@@ -739,7 +739,7 @@ class GitTagVersion {
     // recent tag and number of commits past.
     return parse(
       _runGit(
