Skip to content

Commit 21d528e

Browse files
committed
fix: stop setting global user config
in tekton you can't reliably transfer global settings between steps anymore
1 parent 70c6ded commit 21d528e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/gitclient/setup.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func EnsureUserAndEmailSetup(gitter Interface, dir string, gitUserName string, g
3737
}
3838
}
3939
}
40-
_, err := gitter.Command(dir, "config", "--global", "--add", "user.name", userName)
40+
_, err := gitter.Command(dir, "config", "--add", "user.name", userName)
4141
if err != nil {
4242
return userName, userEmail, fmt.Errorf("Failed to set the git username to %s: %w", userName, err)
4343
}
@@ -50,7 +50,7 @@ func EnsureUserAndEmailSetup(gitter Interface, dir string, gitUserName string, g
5050
userEmail = DefaultGitUserEmail
5151
}
5252
}
53-
_, err := gitter.Command(dir, "config", "--global", "--add", "user.email", userEmail)
53+
_, err := gitter.Command(dir, "config", "--add", "user.email", userEmail)
5454
if err != nil {
5555
return userName, userEmail, fmt.Errorf("Failed to set the git email to %s: %w", userEmail, err)
5656
}
@@ -68,8 +68,8 @@ func SetUserAndEmail(gitter Interface, dir string, gitUserName string, gitUserEm
6868
userEmail = gitUserEmail
6969
} else {
7070
// lets load the current values and if they are specified lets not modify them as they are probably correct
71-
userName, _ = gitter.Command(dir, "config", "--global", "--get", "user.name")
72-
userEmail, _ = gitter.Command(dir, "config", "--global", "--get", "user.email")
71+
userName, _ = gitter.Command(dir, "config", "--get", "user.name")
72+
userEmail, _ = gitter.Command(dir, "config", "--get", "user.email")
7373

7474
if userName != "" && userEmail != "" {
7575
log.Logger().Infof("have git user name %s and email %s setup already so not going to modify them", userName, userEmail)
@@ -91,7 +91,7 @@ func SetUserAndEmail(gitter Interface, dir string, gitUserName string, gitUserEm
9191
}
9292
}
9393
}
94-
_, err := gitter.Command(dir, "config", "--global", "--add", "user.name", userName)
94+
_, err := gitter.Command(dir, "config", "--add", "user.name", userName)
9595
if err != nil {
9696
return userName, userEmail, fmt.Errorf("Failed to set the git username to %s: %w", userName, err)
9797
}
@@ -104,7 +104,7 @@ func SetUserAndEmail(gitter Interface, dir string, gitUserName string, gitUserEm
104104
userEmail = DefaultGitUserEmail
105105
}
106106
}
107-
_, err = gitter.Command(dir, "config", "--global", "--add", "user.email", userEmail)
107+
_, err = gitter.Command(dir, "config", "--add", "user.email", userEmail)
108108
if err != nil {
109109
return userName, userEmail, fmt.Errorf("Failed to set the git email to %s: %w", userEmail, err)
110110
}

0 commit comments

Comments
 (0)