Authentication handler in drracket
This commit is contained in:
@@ -87,16 +87,20 @@ The result remains two values: Git's exit code and the ordered
|
||||
|
||||
Authentication failures are detected centrally after `run-git`, before
|
||||
command-specific result processing. `current-git-authentication-handler`
|
||||
contains a callback that receives the command, processed arguments and an
|
||||
`exn:fail:git-auth` value. If the callback handles authentication and returns a
|
||||
true value, git-cli retries the original command once. The default callback
|
||||
returns `#f`, so existing error behavior is preserved until an authentication
|
||||
handler is configured.
|
||||
defaults to `default-git-authentication-handler`.
|
||||
|
||||
The default handler first uses an existing Git `credential.helper`. When no
|
||||
helper is configured, it asks for username and password/token with
|
||||
`input-prompt`, configures the non-persistent `cache` helper locally, approves
|
||||
the credential through `git credential approve`, and retries the original Git
|
||||
command once.
|
||||
|
||||
A custom handler can still be installed:
|
||||
|
||||
```racket
|
||||
(current-git-authentication-handler
|
||||
(λ (cmd args e)
|
||||
;; Perform credential handling here.
|
||||
;; Perform custom credential handling.
|
||||
#t))
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user