fix(auth): reset other credential helpers in auth setup-git

setup-git appended tea's helper after the helpers Git already had, such
as osxkeychain from the system configuration. Those helpers answered
first, and after a push Git asked every helper to store tea's token, so
it ended up in the macOS Keychain where auth logout never removes it.
setup-git now writes an empty helper for the instance before tea's own,
as tea already does for its per-operation Git credentials. Add
--keep-helpers for the previous behavior.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 21:52:36 +02:00
1 parent ab6228e25b
commit 7b5c9ad9c6
3 files changed
+57 -7

No files matched your search

+3 -2
View File
@@ -106,7 +106,7 @@ func (a *application) gitCredentialCommand() *cobra.Command {
}
func (a *application) setupGitCommand() *cobra.Command {
var local bool
var local, keepHelpers bool
command := &cobra.Command{Use: "setup-git", Short: "Explicitly register tea as a scoped Git credential helper", Annotations: textOutput("setup-git configures Git"), Args: argsExact(0), RunE: func(cmd *cobra.Command, _ []string) error {
target, err := a.resolveTarget(cmd.Context(), false, false)
if err != nil {
@@ -117,9 +117,10 @@ func (a *application) setupGitCommand() *cobra.Command {
return err
}
pinned, _ := a.selectedUser()
return git.SetupCredentials(cmd.Context(), a.deps.Git, git.CredentialSetup{Directory: a.options.cwd, Local: local, Instance: target.Host, Executable: executable, User: pinned, ConfigDirectory: configDir})
return git.SetupCredentials(cmd.Context(), a.deps.Git, git.CredentialSetup{Directory: a.options.cwd, Local: local, KeepHelpers: keepHelpers, Instance: target.Host, Executable: executable, User: pinned, ConfigDirectory: configDir})
}}
command.Flags().BoolVar(&local, "local", false, "Configure only the current Git repository instead of global Git configuration")
command.Flags().BoolVar(&keepHelpers, "keep-helpers", false, "Keep other credential helpers for the instance; they are asked first and store tea's token")
return command
}