Q+A (I'm posting this in case someone else goes down this niche rabbit hole - as it took me a while to figure this out).
Scenario:
You've decided to run a unit-test which 'plays' with creating a local git repo using GitPython.
Your tests run in Tox in a GitHub action which runs an Ubuntu docker image - which has correct .gitconfig file with user.name and user.email. You can even see this correct config if you use GitPython's GitConfigParser or just read the file at git.config.get_config_path.
With all the above looking good, you run your tests, which contain something like:
with open(os.path.join(remote_repo.working_dir, 'readme.md'), 'w') as file:
file.write('# Remote\n')
remote_repo.git.add(A=True)
remote_repo.git.commit(m=commit_text)
in GH and get failures with something like:
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
E git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
E cmdline: git commit -m Initial commit
E stderr: 'Author identity unknown
E
E *** Please tell me who you are.
E
E Run
E
E git config --global user.email "[email protected]"
E git config --global user.name "Your Name"
E
E to set your account's default identity.
E Omit --global to set the identity only in this repository.
E
E fatal: unable to auto-detect email address (got '**********.(none)')'
EDIT Answer moved the answers below.
passenv = HOME
?