Use `GIT_CREDENTIAL_CALLBACK=0` to disable use of credential callback by ianthomas23 · Pull Request #172 · QuantStack/git2cpp · GitHub
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

@ianthomas23

Copy link
Copy Markdown
Member Author

@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