mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08: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:
		@@ -74,6 +74,9 @@ func newGit() {
 | 
				
			|||||||
		log.Fatal("Error retrieving git version: %v", err)
 | 
							log.Fatal("Error retrieving git version: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// force cleanup args
 | 
				
			||||||
 | 
						git.GlobalCommandArgs = []string{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if git.CheckGitVersionAtLeast("2.9") == nil {
 | 
						if git.CheckGitVersionAtLeast("2.9") == nil {
 | 
				
			||||||
		// Explicitly disable credential helper, otherwise Git credentials might leak
 | 
							// Explicitly disable credential helper, otherwise Git credentials might leak
 | 
				
			||||||
		git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "credential.helper=")
 | 
							git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "credential.helper=")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user