Skip to content

Commit 7d16e6d

Browse files
authored
Fixed git args duplication (#13411)
Because newGit() invoked twice (inside PreInstallInit() and GlobalInit()) and git parameters is global object, all git commands call with duplicated args `-c credential.helper= -c protocol.version=2`
1 parent be880d4 commit 7d16e6d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/setting/git.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ func newGit() {
7474
log.Fatal("Error retrieving git version: %v", err)
7575
}
7676

77+
// force cleanup args
78+
git.GlobalCommandArgs = []string{}
79+
7780
if git.CheckGitVersionAtLeast("2.9") == nil {
7881
// Explicitly disable credential helper, otherwise Git credentials might leak
7982
git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "credential.helper=")

0 commit comments

Comments
 (0)