synacktiv/nord-stream

git config user.name and user.email should be defined

niooss-ledger opened this issue · 2 comments

Hello,
First, thank you for publishing this great tool! It seems very useful. I tried using it and it failed in my test environment because git was not configured. More precisely, when nord-stream tried to use git commit, it failed with:

Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@a8ba5aecd84a.(none)')

I fixed this issue by running both git config --global ... commands.

Anyway, during assessments, it would be useful to use custom name and email in git. I suggest using git config user.email ... and git config user.name ... in

def gitInitialization(branch, branchAlreadyExists=False):
logger.verbose("Git init")
if branchAlreadyExists:
gitRunCommand(f"git checkout {branch}")
return
gitRunCommand(f"git checkout --orphan {branch}")
What do you think?

By the way, debugging this issue was hard because the output of git commit was eaten away due to using stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL in gitRunCommand. It would also be nice to have a --debug-subprocess option which would make the output of subprocesses launched by gitRunCommand appear.

Hello, I've added some check to add an email/Name if it's not already configured. I've also added full debug on the git commands which are executed on the host, you should be able to see them with -d

Let me know if it resolves your problem :)

Thanks for your quick fix! I confirm fcecc64 fixed this issue.

By the way, I was surprised by if logger.level <= 10: but it seems correct according to Python's documentation to filter "only when the log level is debug". I learned something new 😃