From b2a2cb8bd1e422475cd93d5b14c9d94bbd3206b5 Mon Sep 17 00:00:00 2001 From: Eric Bode Date: Wed, 6 Sep 2023 13:49:28 +0200 Subject: [PATCH] fix(git): Use absolute path instead Signed-off-by: Eric Bode --- subcommands/git/cmd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subcommands/git/cmd.go b/subcommands/git/cmd.go index 3b83b6fb..7046e257 100644 --- a/subcommands/git/cmd.go +++ b/subcommands/git/cmd.go @@ -8,6 +8,7 @@ import ( "os/user" "path/filepath" "runtime" + "strings" "github.com/foundriesio/fioctl/subcommands" "github.com/sirupsen/logrus" @@ -73,8 +74,10 @@ func doGitCreds(cmd *cobra.Command, args []string) { helperName := "fio" dst := filepath.Join(helperPath, GIT_CREDS_HELPER) if runtime.GOOS == "windows" { + // To get around edge cases with git on Windows we use the absolute path + // So for example the following path will be used: C:/Program\\ Files/Git/bin/git-credential-fio.exe dst += ".exe" - helperName += ".exe" + helperName = strings.ReplaceAll(filepath.ToSlash(dst), " ", "\\ ") } if len(sudoer) > 0 {