2

Please spare me the lecture on how this is a bad practice... I know, but it is a money issue.

We have multiple people who have to use a single computer as needed for a certain project. I want them to always be forced to specify the --author= when committing, so I do NOT want to have an environment variable set up which would allow them to "forget".

However, it seems --author= will only override environment variables, so it can not be used when one is not set.

Is there a way I can either set environment variables that will fail when one tries to commit with them, or another method which I can use to force them to add the switch?

If all else fails, I will write my own "git" override script that asks for the author from user input, but I was hoping for something cleaner.

A similar question was asked here: Git specify user and e-mail on commit?

But it never was answered satisfactorily.

trex005
  • 5,015
  • 4
  • 28
  • 41
  • 1
    Is allowing them to use different users on said computer not an option? Wouldn't that allow them to have distinct git user configurations? – ajxs Jun 14 '18 at 03:12
  • While it IS an option, it's WAY easier not to. I'd rather not have maintain different user accounts :/ – trex005 Jun 14 '18 at 06:34
  • `Please spare me the lecture on how this is a bad practice... I know, but it is a money issue.` This is great Also, I'm sorry you had to deal with this. Also, I think your idea of writing a custom script is your best bet, hopefully this worked out well for you. – Brady Dowling Mar 04 '20 at 21:40

2 Answers2

0

Remove below code from .git/config and it will prompt you for username and password every time.

[credential]
    helper = store
    # or helper=cache
dkm007
  • 145
  • 2
  • 6
-1

I found a link which might help you with changing author name for old commits. Change commit author at one specific commit

dkm007
  • 145
  • 2
  • 6