From 7a62ee693f797dc4ac4f2567b51f97da6a3757a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Ri=C3=9Fe?= Date: Fri, 14 Mar 2025 15:48:29 +0100 Subject: [PATCH] fix: set git identity for p2phttp processes In some situations it could happen that `git annex p2phttp` needs some kind of maintenance work resulting in a commit, but without a configured git identity p2phttp would refuse to run. This could break p2phttp support. Setting `GIT_AUTHOR_{NAME,EMAIL}` should remedy this issue. --- routers/web/repo/annex.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/web/repo/annex.go b/routers/web/repo/annex.go index 852b5a11cc..d696a35100 100644 --- a/routers/web/repo/annex.go +++ b/routers/web/repo/annex.go @@ -19,6 +19,7 @@ import ( "code.gitea.io/gitea/modules/annex" "code.gitea.io/gitea/modules/graceful" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/setting" services_context "code.gitea.io/gitea/services/context" ) @@ -93,6 +94,10 @@ func AnnexP2PHTTP(ctx *services_context.Context) { Pdeathsig: syscall.SIGINT, } cmd.Cancel = func() error { return cmd.Process.Signal(os.Interrupt) } + cmd.Env = append(os.Environ(), + "GIT_AUTHOR_NAME="+setting.AppName, + "GIT_AUTHOR_EMAIL="+setting.RunUser+"@"+setting.Domain, + ) _ = cmd.Run() }(p2phttpCtx) graceful.GetManager().RunAtTerminate(p2phttpCtxCancel)