mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-30 02:48:26 +00:00 
			
		
		
		
	| @@ -167,7 +167,21 @@ func EnvironmentToConfig(cfg ConfigProvider, envs []string) (changed bool) { | ||||
| 	return changed | ||||
| } | ||||
|  | ||||
| // InitGiteaEnvVars initilises the environment for gitea | ||||
| // InitGiteaEnvVars initializes the environment variables for gitea | ||||
| func InitGiteaEnvVars() { | ||||
| 	_ = os.Unsetenv("XDG_CONFIG_HOME") // unset if set as HOME is managed by gitea | ||||
| 	// Ideally Gitea should only accept the environment variables which it clearly knows instead of unsetting the ones it doesn't want, | ||||
| 	// but the ideal behavior would be a breaking change, and it seems not bringing enough benefits to end users, | ||||
| 	// so at the moment we could still keep "unsetting the unnecessary environments" | ||||
|  | ||||
| 	// HOME is managed by Gitea, Gitea's git should use "HOME/.gitconfig". | ||||
| 	// But git would try "XDG_CONFIG_HOME/git/config" first if "HOME/.gitconfig" does not exist, | ||||
| 	// then our git.InitFull would still write to "XDG_CONFIG_HOME/git/config" if XDG_CONFIG_HOME is set. | ||||
| 	_ = os.Unsetenv("XDG_CONFIG_HOME") | ||||
|  | ||||
| 	_ = os.Unsetenv("GIT_AUTHOR_NAME") | ||||
| 	_ = os.Unsetenv("GIT_AUTHOR_EMAIL") | ||||
| 	_ = os.Unsetenv("GIT_AUTHOR_DATE") | ||||
| 	_ = os.Unsetenv("GIT_COMMITTER_NAME") | ||||
| 	_ = os.Unsetenv("GIT_COMMITTER_EMAIL") | ||||
| 	_ = os.Unsetenv("GIT_COMMITTER_DATE") | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user