Title: [BUG] Azure DevOps repository cloning fails due to incorrect authentication method Description · Issue #522 · sourcebot-dev/sourcebot · GitHub
Open Graph Title: [BUG] Azure DevOps repository cloning fails due to incorrect authentication method Description · Issue #522 · sourcebot-dev/sourcebot
X Title: [BUG] Azure DevOps repository cloning fails due to incorrect authentication method Description · Issue #522 · sourcebot-dev/sourcebot
Description: Describe the bug When connecting to an Azure DevOps instance, the initial API connection and repository discovery succeed, but the subsequent git clone operation fails with an Authentication failed error. This issue stems from the way re...
Open Graph Description: Describe the bug When connecting to an Azure DevOps instance, the initial API connection and repository discovery succeed, but the subsequent git clone operation fails with an Authentication failed...
X Description: Describe the bug When connecting to an Azure DevOps instance, the initial API connection and repository discovery succeed, but the subsequent git clone operation fails with an Authentication failed...
Opengraph URL: https://github.com/sourcebot-dev/sourcebot/issues/522
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Azure DevOps repository cloning fails due to incorrect authentication method Description","articleBody":"### Describe the bug\n\nWhen connecting to an Azure DevOps instance, the initial API connection and repository discovery succeed, but the subsequent git clone operation fails with an Authentication failed error.\n\nThis issue stems from the way repoManager constructs the clone URL for Azure DevOps repositories.\n\n**Logs**\n\n```\nThe initial sync job shows a successful API connection:\n\n[backend] | 2025-09-19T06:42:54.369Z info: [connection-manager] Connection sync job for connection azure_devops (id: 5, jobId: 17) completed\n```\n\n\n\nHowever, the cloning process initiated by repoManager fails:\n\n```\n[backend] | 2025-09-19T06:42:54.796Z error: [repo-manager] Failed to sync repository [internal-devops-host]/mpilot_perception/auto-tagging-platform ... Error: Failed to clone repository ...\n[backend] | fatal: could not read Password for 'https://xxxxx@[internal-devops-host]': No such device or address\n```\n\n\n\n\n**Root Cause Analysis**\n\nIncorrect Credential Formatting: In packages/backend/src/repoManager.ts, the getCloneCredentialsForRepo function returns only a password (the PAT) for azuredevops connections.\n\nIncorrect URL Construction: The syncGitRepository function in the same file has a fallback mechanism that incorrectly assigns the password to the username field of the clone URL when username is not provided. This results in an improperly formatted URL like https://\u003cPAT\u003e@[internal-devops-host]/....\n\nAzure DevOps Authentication Mechanism: Azure DevOps does not support authentication via a PAT embedded in the username part of a URL. It requires the PAT to be supplied as the password in a Basic Authentication scheme, typically with an arbitrary (or empty) username.\n\n\u003cimg width=\"897\" height=\"538\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/ca758c95-1002-4af7-959f-3d8e7a788c41\" /\u003e\n\nhttps://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops\u0026tabs=Windows#use-a-pat\n\nManual Verification\n\nWe have confirmed the correct authentication method via the command line.\n\nFailed Attempt (mimicking current behavior):\n\n```\ngit clone https://pat:YOUR_PAT@[internal-devops-host]/...\n# Result: fatal: Authentication failed\n```\n\n\n\n\nSuccessful Attempt (correct method):\nThis method injects the credentials directly into the HTTP header, which is the correct way to authenticate with Azure DevOps.\n\n```\nTOKEN=\"YOUR_PAT\"\nAUTH_HEADER=\"Authorization: Basic $(echo -n \":$TOKEN\" | base64)\"\ngit -c http.extraHeader=\"$AUTH_HEADER\" clone https://[internal-devops-host]/...\n# Result: Success, cloning begins.\n```\n\n\n\nSuggested Solution\n\nThe repoManager needs to be updated to handle Azure DevOps authentication correctly.\n\nModify git.ts: The cloneRepository and fetchRepository functions in packages/backend/src/git.ts should be updated to accept an optional config parameter (a string array) to pass custom configurations like http.extraHeader to the underlying simple-git call.\n\nModify repoManager.ts: In syncGitRepository, add logic to detect if the repository is from an azuredevops connection.\n\nIf it is, construct the Authorization: Basic ... header using the PAT and pass it to cloneRepository/fetchRepository via the new config parameter.\nIf it is not, retain the existing logic of embedding credentials in the URL.\nThis will ensure that Azure DevOps repositories are cloned using the correct, header-based authentication method without affecting other Git providers.\n\n### To reproduce\n\n1. Configure a new code host connection of type azuredevops.\n2. Provide the URL for your Azure DevOps server (e.g., https://[internal-devops-host]) and a valid Personal Access Token (PAT) with at least Code (Read) permissions.\n3. Configure the connection to sync a specific repository.\n4. Trigger a sync for the connection.\n5. Observe the backend logs for the repo-manager service.\n\n### Sourcebot deployment information\n\nSourcebot version (e.g. v3.0.1): 4.7.0\n\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/yurika96","@type":"Person","name":"yurika96"},"datePublished":"2025-09-19T06:59:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/522/sourcebot/issues/522"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:91c90d5c-faab-4482-d535-03c58f4dfb28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B55A:6435C:280242E:36C7CFA:6A4EF322 |
| html-safe-nonce | 72360c2dbf63ca7b1692fe565a7485deb6e02d40b281a2e35e8625316938b0dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTVBOjY0MzVDOjI4MDI0MkU6MzZDN0NGQTo2QTRFRjMyMiIsInZpc2l0b3JfaWQiOiIyNTExMzE1NjgwOTU2OTY5NzYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f016b85d80b0af05dad74d95b6ffefb520c23aece73e76dd208d59559720434f |
| hovercard-subject-tag | issue:3433147491 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sourcebot-dev/sourcebot/522/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ab77a83dd18339b6b1f096be1c2c96780561174992b13995896e223dea216eb/sourcebot-dev/sourcebot/issues/522 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ab77a83dd18339b6b1f096be1c2c96780561174992b13995896e223dea216eb/sourcebot-dev/sourcebot/issues/522 |
| og:image:alt | Describe the bug When connecting to an Azure DevOps instance, the initial API connection and repository discovery succeed, but the subsequent git clone operation fails with an Authentication failed... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yurika96 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/sourcebot-dev/sourcebot git https://github.com/sourcebot-dev/sourcebot.git |
| octolytics-dimension-user_id | 135396723 |
| octolytics-dimension-user_login | sourcebot-dev |
| octolytics-dimension-repository_id | 846729675 |
| octolytics-dimension-repository_nwo | sourcebot-dev/sourcebot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 846729675 |
| octolytics-dimension-repository_network_root_nwo | sourcebot-dev/sourcebot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width