@@ -151,6 +151,12 @@ const stateHelper = __importStar(__nccwpck_require__(4866));
151151const urlHelper = __importStar(__nccwpck_require__(9437));
152152const uuid_1 = __nccwpck_require__(5840);
153153const IS_WINDOWS = process.platform === 'win32';
154+ // Use case-insensitive gitdir matching on Windows to handle path casing mismatches
155+ // between the runner's GITHUB_WORKSPACE and the actual filesystem casing.
156+ // See: https://github.com/actions/checkout/issues/2345
157+ const INCLUDE_IF_GITDIR = IS_WINDOWS
158+ ? 'includeIf.gitdir/i:'
159+ : 'includeIf.gitdir:';
154160const SSH_COMMAND_KEY = 'core.sshCommand';
155161function createAuthHelper(git, settings) {
156162 return new GitAuthHelper(git, settings);
@@ -270,7 +276,7 @@ class GitAuthHelper {
270276 let submoduleGitDir = path.dirname(configPath); // The config file is at .git/modules/submodule-name/config
271277 submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
272278 // Configure host includeIf
273- yield this.git.config(`includeIf.gitdir: ${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
279+ yield this.git.config(`${INCLUDE_IF_GITDIR} ${submoduleGitDir}.path`, credentialsConfigPath, false, // globalConfig?
274280 false, // add?
275281 configPath);
276282 // Container submodule git directory
@@ -280,7 +286,7 @@ class GitAuthHelper {
280286 relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
281287 const containerSubmoduleGitDir = path.posix.join('/github/workspace', relativeSubmoduleGitDir);
282288 // Configure container includeIf
283- yield this.git.config(`includeIf.gitdir: ${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, // globalConfig?
289+ yield this.git.config(`${INCLUDE_IF_GITDIR} ${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, // globalConfig?
284290 false, // add?
285291 configPath);
286292 }
@@ -410,10 +416,10 @@ class GitAuthHelper {
410416 let gitDir = path.join(this.git.getWorkingDirectory(), '.git');
411417 gitDir = gitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
412418 // Configure host includeIf
413- const hostIncludeKey = `includeIf.gitdir: ${gitDir}.path`;
419+ const hostIncludeKey = `${INCLUDE_IF_GITDIR} ${gitDir}.path`;
414420 yield this.git.config(hostIncludeKey, credentialsConfigPath);
415421 // Configure host includeIf for worktrees
416- const hostWorktreeIncludeKey = `includeIf.gitdir: ${gitDir}/worktrees/*.path`;
422+ const hostWorktreeIncludeKey = `${INCLUDE_IF_GITDIR} ${gitDir}/worktrees/*.path`;
417423 yield this.git.config(hostWorktreeIncludeKey, credentialsConfigPath);
418424 // Container git directory
419425 const workingDirectory = this.git.getWorkingDirectory();
@@ -425,10 +431,10 @@ class GitAuthHelper {
425431 // Container credentials config path
426432 const containerCredentialsPath = path.posix.join('/github/runner_temp', path.basename(credentialsConfigPath));
427433 // Configure container includeIf
428- const containerIncludeKey = `includeIf.gitdir: ${containerGitDir}.path`;
434+ const containerIncludeKey = `${INCLUDE_IF_GITDIR} ${containerGitDir}.path`;
429435 yield this.git.config(containerIncludeKey, containerCredentialsPath);
430436 // Configure container includeIf for worktrees
431- const containerWorktreeIncludeKey = `includeIf.gitdir: ${containerGitDir}/worktrees/*.path`;
437+ const containerWorktreeIncludeKey = `${INCLUDE_IF_GITDIR} ${containerGitDir}/worktrees/*.path`;
432438 yield this.git.config(containerWorktreeIncludeKey, containerCredentialsPath);
433439 }
434440 });
@@ -565,7 +571,7 @@ class GitAuthHelper {
565571 const credentialsPaths = new Set();
566572 try {
567573 // Get all includeIf.gitdir keys
568- const keys = yield this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, // globalConfig?
574+ const keys = yield this.git.tryGetConfigKeys('^includeIf\\.gitdir(/i)? :', false, // globalConfig?
569575 configPath);
570576 for (const key of keys) {
571577 // Get all values for this key
0 commit comments