Fixing issue #5143 #6
Annotations
2 errors and 2 warnings
|
copilot
Git checkout failed with exit code: 128
|
|
copilot
Git checkout failed with exit code: 128\n```\n\nThis occurs because git's automatic promisor fetches (used to retrieve missing objects in partial clones) don't inherit the authorization headers that were passed as command-line arguments to the main git operations.\n\n## Root Cause\n\nThe current implementation only passes authentication as command line arguments (`-c http.extraheader=...`) to explicit git commands like fetch and checkout. However, git's internal promisor fetches are separate operations that don't inherit these command line configurations and need the authentication to be available in git config.\n\n## Solution\n\nWhen partial clones are detected (presence of fetch filters), the authentication headers are now set up in git config using `gitCommandManager.GitConfig()`. This ensures that all git operations, including automatic promisor fetches, have access to the authentication credentials.\n\n### Key Changes\n\n1. **Authentication for partial clones**: Added logic in `GitSourceProvider.cs` to detect when fetch filters are being used and set up authentication in git config\n2. **Automatic cleanup**: Authentication config is added to the `configModifications` dictionary for proper cleanup via existing mechanisms \n3. **Error handling**: Added warning if git config setup fails, but allows operation to continue\n4. **Minimal scope**: Only affects scenarios using partial clones with authentication\n\n### How it works\n\n```csharp\n// When using partial clones (fetch filters), set up authentication in git config\n// so that git's automatic promisor fetches can access credentials\nif (additionalFetchFilterOptions.Any())\n{\n string authHeader = GenerateAuthHeader(executionContext, username, password, useBearerAuthType);\n string configValue = $\"AUTHORIZATION: {authHeader}\";\n int exitCode_configAuth = await gitCommandManager.GitConfig(executionContext, targetPath, configKey, configValue);\n // ... error handling and cleanup tracking\n}\n```\n\n### Testing\n\nAdded comprehensive unit test `TestPartialCloneAuthenticationConfigSetup` that verifies git config authentication is properly set up when using partial clones. Enhanced the `MockGitCliManager` to support testing git config operations.\n\n### Impact\n\nThis change only affects scenarios where:\n- Fetch filters are being used (partial clones like `blob:none`)\n- Git authentication headers are supported (v2.9+)\n- Credentials are not self-managed\n- `UseFetchFilterInCheckoutTask` knob is enabled\n\nThe fix is backward compatible and doesn't impact existing git operations that don't use partial clones.\n\nFixes #5143."
|
|
copilot
Git checkout failed on shallow repository, this might because of git fetch with depth '1' doesn't include the checkout commit 'refs/remotes/origin/a9e9229e984db6f5989a8ec0d29ea79500e566cd'. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=829603)
|
|
copilot
Git checkout failed on shallow repository, this might because of git fetch with depth '1' doesn't include the checkout commit 'refs/remotes/origin/a9e9229e984db6f5989a8ec0d29ea79500e566cd'. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=829603)\n##[error]Git checkout failed with exit code: 128\nFinishing: Checkout Test - Self\n```\n## Comments on the Issue (you are @copilot in this section)\n\n<comments>\n\n</comments>\n\n","owner":"microsoft","repo":"azure-pipelines-agent","numSnippets":10}
|
Artifacts
Produced during runtime
| Name | Size | Digest | |
|---|---|---|---|
|
results
Expired
|
11.3 KB |
sha256:ff58721d0e4afba2921a4fcf1aae6cc0c6d8485b399363a5289810c4e14eb572
|
|