This commit is contained in:
eric sciple
2025-10-16 21:58:52 +00:00
parent 2bcd7c6585
commit e4894fca20
7 changed files with 199 additions and 10 deletions

View File

@@ -448,11 +448,29 @@ class GitAuthHelper {
await this.removeGitConfig(this.tokenConfigKey)
await this.removeSubmoduleGitConfig(this.tokenConfigKey)
// Remove includeIf
for (const includeKey of this.credentialsIncludeKeys) {
await this.removeGitConfig(includeKey)
// Remove includeIf entries that point to git-credentials-*.config files
// This is more aggressive than tracking keys, but necessary since cleanup
// runs in a post-step where this.credentialsIncludeKeys is empty
try {
// Get all includeIf.gitdir keys
const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:')
for (const key of keys) {
// Get all values for this key
const values = await this.git.tryGetConfigValues(key)
if (values.length > 0) {
// Remove only values that match git-credentials-<uuid>.config pattern
for (const value of values) {
if (/git-credentials-[0-9a-f-]+\.config$/i.test(value)) {
await this.git.tryConfigUnsetValue(key, value)
}
}
}
}
} catch (err) {
// Ignore errors - this is cleanup code
core.debug(`Error during includeIf cleanup: ${err}`)
}
this.credentialsIncludeKeys = []
// Remove submodule includeIf
await this.git.submoduleForeach(