I would like to do the following, which works with the
ssh root@host -t "git config --ONLY_FOR_CURRENT_SESSION user.name 'Max Payne'; git config --ONLY_FOR_CURRENT_SESSION user.email 'email@example.com'; bash"
If you can ssh in to the machine, you can also clone the repository and simply work locally, and that is usually the way to go.
That said, if you insist on working this way, you can, rather than setting up configuration files (which are necessarily shared between separate sessions, since the file system itself is also shared between separate sessions), set numerous environment variables as described in the top-level
git documentation. These include
GIT_COMMITTER_EMAIL, which are further described in the
git commit-tree documentation.
Environment variables are inherited from parent processes to child processes. They do not cross the boundary in the other direction, i.e., no child process can affect its parent's environment data. For this reason all environment-setting commands are (must be) built in to the shell.