From [forge:feature-requests:#34] The post-upgrade email as well as the git pre-receive hook set up in [#1997] should put the username in the new git origin URL. Otherwise the client will default to using the local username (e.g. root or whatever).
For the pre-recieve hook, it looks like the username will be available as an env var, but it may vary depending on the way the git remote is running. So this should be tested over a git ssh connection (not just sandbox local filesystem), to see what var it uses.
This was done in [#5427] and is up for review in
forge-classic:cj/5427