Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Agent.Plugins/GitSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,27 @@ public async Task GetSourceAsync(
throw new InvalidOperationException($"Git config failed with exit code: {exitCode_config}");
}
}

// persist credentials for authorityUrl so submodules at the same root domain can authenticate
if (checkoutSubmodules)
{
string authorityUrl = repositoryUrl.AbsoluteUri.Replace(repositoryUrl.PathAndQuery, string.Empty);
string submoduleConfigKey = $"http.{authorityUrl}.extraheader";
configModifications[submoduleConfigKey] = configValue.Trim('\"');

if (gitUseSecureParameterPassing)
{
await SetAuthTokenInGitConfig(executionContext, gitCommandManager, targetPath, submoduleConfigKey, configValue.Trim('\"'));
}
else
{
int exitCode_config = await gitCommandManager.GitConfig(executionContext, targetPath, submoduleConfigKey, configValue);
if (exitCode_config != 0)
{
throw new InvalidOperationException($"Git config failed with exit code: {exitCode_config}");
}
}
}
}

if (!gitSupportAuthHeader && !exposeCred)
Expand Down