mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
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:
3 files changed
+57
-7
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user