fix: Report git authentication failures instead of silently ignoring them#10997
Open
paipeline wants to merge 2 commits intotreeverse:mainfrom
Open
fix: Report git authentication failures instead of silently ignoring them#10997paipeline wants to merge 2 commits intotreeverse:mainfrom
paipeline wants to merge 2 commits intotreeverse:mainfrom
Conversation
…them - Added authentication error detection in clone() function to catch and convert authentication-related InternalCloneErrors to GitAuthError with descriptive messages - Added authentication error detection in _pull() function to catch auth failures during git fetch operations - Comprehensive test coverage for various authentication error patterns including username/password prompts, bad credentials, access denied, HTTP 401/403 errors - Case-insensitive detection of authentication keywords in error messages - Non-authentication errors still propagate as expected (CloneError or SCMError) Fixes treeverse#10992: DVC now properly reports authentication failures with clear error messages and troubleshooting links instead of silently appearing to succeed.
|
paipeline seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10997 +/- ##
==========================================
- Coverage 90.68% 82.51% -8.17%
==========================================
Files 504 504
Lines 39795 41025 +1230
Branches 3141 3244 +103
==========================================
- Hits 36087 33852 -2235
- Misses 3042 6449 +3407
- Partials 666 724 +58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10992 - DVC fetch now properly reports git authentication failures instead of silently ignoring them and showing "Everything is up to date."
Problem
When DVC imports data from another repository and the user provides incorrect credentials (e.g., bad PAT token), DVC was silently failing and reporting "Everything is up to date" without indicating any authentication error. This made it difficult for users to diagnose authentication issues.
Root Cause
The issue was in two key functions:
clone()indvc/scm.py- caughtInternalCloneErrorand re-raised as genericCloneErrorwith just "SCM error" message_pull()indvc/repo/open_repo.py- SCM authentication errors during fetch operations were not being caught and converted to user-friendly messagesSolution
GitAuthErrorwith descriptive messages and troubleshooting linksChanges Made
dvc/scm.pyclone()function to detect authentication errors inInternalCloneErrormessagesGitAuthErrorwith detailed error messagesCloneErroras beforedvc/repo/open_repo.py_pull()function to catch and handle authentication errors during git fetchTests
tests/unit/test_auth_error_reporting.py)Error Messages Detected
The fix detects these common authentication error patterns:
Example Before/After
Before:
After:
Testing
Backward Compatibility
This change is fully backward compatible: