Skip to content

Use GIT_CREDENTIAL_CALLBACK=0 to disable use of credential callback#172

Open
ianthomas23 wants to merge 1 commit into
mainfrom
disable-credentials-callback
Open

Use GIT_CREDENTIAL_CALLBACK=0 to disable use of credential callback#172
ianthomas23 wants to merge 1 commit into
mainfrom
disable-credentials-callback

Conversation

@ianthomas23

Copy link
Copy Markdown
Member

This adds the ability to disable the use of the libgit2 credential callback which requests a username and password from the user, using an environment variable GIT_CREDENTIAL_CALLBACK=0. Possible use cases for this are:

  • Limiting access to remote repositories that do not need authentication.
  • Downstream projects which implement their own authentication, perhaps via a CORS proxy or some other interception of the remote https request.

I considered a number of other possible environment variables:

  • GIT_DISABLE_CREDENTIALS=1
  • GIT_DISABLE_CREDENTIAL_CALLBACK=1
  • GIT_NO_CREDENTIAL_CALLBACK=1

and in the end I have opted for what I think is the least bad option. I could easily be persuaded to use a different one.

If you disable the callback then a request that requires authentication will fail with the following error message:

error: remote authentication required but no callback set

@ianthomas23 ianthomas23 added the enhancement New feature or request label Jun 26, 2026
@ianthomas23 ianthomas23 marked this pull request as draft June 26, 2026 10:09
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.18%. Comparing base (760ca88) to head (294cbb9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
+ Coverage   88.16%   88.18%   +0.02%     
==========================================
  Files          63       63              
  Lines        2991     2997       +6     
  Branches      373      376       +3     
==========================================
+ Hits         2637     2643       +6     
  Misses        354      354              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ianthomas23

Copy link
Copy Markdown
Member Author

Wasm tests all pass https://github.com/QuantStack/git2cpp/actions/runs/28231520400/job/83636164940 so this is good for review now.

@ianthomas23 ianthomas23 marked this pull request as ready for review June 26, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant