1diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart
2index 8e4cb81340..2c20940423 100644
3--- a/dev/bots/prepare_package.dart
4+++ b/dev/bots/prepare_package.dart
5@@ -526,7 +526,7 @@ class ArchiveCreator {
6
7 Future<String> _runGit(List<String> args, {Directory? workingDirectory}) {
8 return _processRunner.runProcess(
9- <String>['git', ...args],
10+ <String>['git', '--git-dir', '.git', ...args],
11 workingDirectory: workingDirectory ?? flutterRoot,
12 );
13 }
14diff --git a/packages/flutter_tools/lib/src/commands/downgrade.dart b/packages/flutter_tools/lib/src/commands/downgrade.dart
15index 666c190067..b6c3761f6f 100644
16--- a/packages/flutter_tools/lib/src/commands/downgrade.dart
17+++ b/packages/flutter_tools/lib/src/commands/downgrade.dart
18@@ -118,7 +118,7 @@ class DowngradeCommand extends FlutterCommand {
19 // Detect unknown versions.
20 final ProcessUtils processUtils = _processUtils!;
21 final RunResult parseResult = await processUtils.run(<String>[
22- 'git', 'describe', '--tags', lastFlutterVersion,
23+ 'git', '--git-dir', '.git', 'describe', '--tags', lastFlutterVersion,
24 ], workingDirectory: workingDirectory);
25 if (parseResult.exitCode != 0) {
26 throwToolExit('Failed to parse version for downgrade:\n${parseResult.stderr}');
27@@ -191,7 +191,7 @@ class DowngradeCommand extends FlutterCommand {
28 continue;
29 }
30 final RunResult parseResult = await _processUtils!.run(<String>[
31- 'git', 'describe', '--tags', sha,
32+ 'git', '--git-dir', '.git', 'describe', '--tags', sha,
33 ], workingDirectory: workingDirectory);
34 if (parseResult.exitCode == 0) {
35 buffer.writeln('Channel "${getNameForChannel(channel)}" was previously on: ${parseResult.stdout}.');
36diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
37index dc47f17057..8068e2d1f5 100644
38--- a/packages/flutter_tools/lib/src/version.dart
39+++ b/packages/flutter_tools/lib/src/version.dart
40@@ -111,7 +111,7 @@ class FlutterVersion {
41 String? channel = _channel;
42 if (channel == null) {
43 final String gitChannel = _runGit(
44- 'git rev-parse --abbrev-ref --symbolic $kGitTrackingUpstream',
45+ 'git --git-dir .git rev-parse --abbrev-ref --symbolic $kGitTrackingUpstream',
46 globals.processUtils,
47 _workingDirectory,
48 );
49@@ -119,7 +119,7 @@ class FlutterVersion {
50 if (slash != -1) {
51 final String remote = gitChannel.substring(0, slash);
52 _repositoryUrl = _runGit(
53- 'git ls-remote --get-url $remote',
54+ 'git --git-dir .git ls-remote --get-url $remote',
55 globals.processUtils,
56 _workingDirectory,
57 );
58@@ -298,7 +298,7 @@ class FlutterVersion {
59 /// the branch name will be returned as `'[user-branch]'`.
60 String getBranchName({ bool redactUnknownBranches = false }) {
61 _branch ??= () {
62- final String branch = _runGit('git rev-parse --abbrev-ref HEAD', globals.processUtils);
63+ final String branch = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', globals.processUtils);
64 return branch == 'HEAD' ? channel : branch;
65 }();
66 if (redactUnknownBranches || _branch!.isEmpty) {
67@@ -331,7 +331,7 @@ class FlutterVersion {
68 /// wrapper that does that.
69 @visibleForTesting
70 static List<String> gitLog(List<String> args) {
71- return <String>['git', '-c', 'log.showSignature=false', 'log'] + args;
72+ return <String>['git', '-c', 'log.showSignature=false', '--git-dir', '.git', 'log'] + args;
73 }
74
75 /// Gets the release date of the latest available Flutter version.
76@@ -708,7 +708,7 @@ class GitTagVersion {
77 String gitRef = 'HEAD'
78 }) {
79 if (fetchTags) {
80- final String channel = _runGit('git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory);
81+ final String channel = _runGit('git --git-dir .git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory);
82 if (channel == 'dev' || channel == 'beta' || channel == 'stable') {
83 globals.printTrace('Skipping request to fetchTags - on well known channel $channel.');
84 } else {
85@@ -718,7 +718,7 @@ class GitTagVersion {
86 }
87 // find all tags attached to the given [gitRef]
88 final List<String> tags = _runGit(
89- 'git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n');
90+ 'git --git-dir .git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n');
91
92 // Check first for a stable tag
93 final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$');
94@@ -739,7 +739,7 @@ class GitTagVersion {
95 // recent tag and number of commits past.
96 return parse(
97 _runGit(
98- 'git describe --match *.*.* --long --tags $gitRef',
99+ 'git --git-dir .git describe --match *.*.* --long --tags $gitRef',
100 processUtils,
101 workingDirectory,
102 )