1
0
mirror of https://github.com/go-gitea/gitea synced 2024-12-24 03:35:55 +01:00

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`
This commit is contained in:
Viktor Suprun 2020-11-03 22:35:09 +11:00 committed by GitHub
parent be880d4063
commit 7d16e6db8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,6 +74,9 @@ func newGit() {
log.Fatal("Error retrieving git version: %v", err)
}
// force cleanup args
git.GlobalCommandArgs = []string{}
if git.CheckGitVersionAtLeast("2.9") == nil {
// Explicitly disable credential helper, otherwise Git credentials might leak
git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "credential.helper=")