From db7dbd5a6bc89423672eed4469d09c92c60bdfec Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 18 Sep 2026 11:07:45 +0200 Subject: [PATCH] test: stop tests from writing into `~/.ssh` (#39348) --- modules/setting/testenv.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/setting/testenv.go b/modules/setting/testenv.go index 0e52e73eb20..38bb936197e 100644 --- a/modules/setting/testenv.go +++ b/modules/setting/testenv.go @@ -121,6 +121,8 @@ func SetupGiteaTestEnv() { panic("SetupGiteaTestEnv failed, paths are not initialized") } + SSH.RootPath = AppDataTempDir("ssh").JoinPath() // prevent tests from writing into ~/.ssh + // TODO: some git repo hooks (test fixtures) still use these env variables, need to be refactored in the future _ = os.Setenv("GITEA_ROOT", giteaRoot) _ = os.Setenv("GITEA_CONF", giteaConf) // test fixture git hooks use "$GITEA_ROOT/$GITEA_CONF" in their scripts