Skip to content

Conversation

@Yashagarwal9798
Copy link
Contributor

Fixes #59341

Summary

This PR improves error reporting when SSH or User/Pass authentication fails in non-interactive environments (e.g., CI/CD pipelines). It replaces the misleading GitError: user cancelled credential request with a detailed error message offering actionable solutions.

Changes

  • stdlib/LibGit2/src/callbacks.jl: Introduced exhausted_abort_noninteractive(). This helper is now called by authenticate_ssh and authenticate_userpass when credentials fail and allow_prompt=false.
  • stdlib/LibGit2/test/libgit2-tests.jl: Updated 5 existing tests to verify the new, descriptive error message is thrown.

New Error Output

Instead of "user cancelled", users will now see:

Authentication failed. The remote server requires authentication, but no valid credentials were provided and the environment is non-interactive (prompting is disabled).

To provide SSH credentials, you can:

  • Set the SSH_KEY_PATH environment variable...
  • Ensure ssh-agent is running...
  • [etc]

Testing

  • Verified that interactive mode behavior remains unchanged.
  • Confirmed that setting allow_prompt=false triggers the new error message instead of the generic GitError.

@DilumAluthge
Copy link
Member

@Yashagarwal9798 Just to check, did you use any generative AI tools to write the code or the PR description?

@Yashagarwal9798
Copy link
Contributor Author

Yes, I used generative AI to help refine the implementation and description after performing a detailed manual analysis of the issue. I have carefully reviewed all the code to ensure it meets Julia's standards and correctly addresses the problem

@DilumAluthge
Copy link
Member

Please disclose the use of generative AI when you open the PR. This is a requirement of the Julia repo, documented in CONTRIBUTING.md.

I notice that you were also reminded of this requirement previously: #60640 (comment)

@Yashagarwal9798
Copy link
Contributor Author

Understood. I apologize for the oversight and will ensure all future PRs include the required AI disclosure as per the contribution guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a better error message when ssh credentials fail in a non-interactive environment

3 participants