I have an issue where I keep getting an error message as below:
$ git commit -m "Update"
fatal: invalid date format: -7 -8 12:3:00
whenever I try to commit to or clone from a github repository - using my terminal (MacOS).
To attempt to change my date format to a 'valid' one, I have tried running commands like:
$ git commit --date="2020-07-11"
$ GIT_COMMITER_DATE="date" git commit --amend --no-edit --date "date"
and also tried changing date format to relative time:
$ git commit -m "Test" --date=format:relative:3.hours.ago
But none of these commands, including many others, work; I keep getting the same message, 'fatal: invalid date format:...'. Currently, I am unable to commit, push, nor clone my repositories on github.
If anyone has encountered a similar problem, I would absolutely love any help/advice on this issue, thanks so much.
Likely source of the error message: https://github.com/git/git/blob/bd42bbe1a46c0fe486fc33e82969275e27e4dc19/ident.c#L436
Your environment (which is managed by your shell) includes GIT_AUTHOR_DATE
or GIT_COMMITTER_DATE
(or both) with an invalid value (likely -7 -8 12:3:00
). You probably ran something like the following commands:
$ export GIT_AUTHOR_DATE="-7 -8 12:3:00"
$ export GIT_COMMITTER_DATE="-7 -8 12:3:00"
Fix the problem by removing GIT_AUTHOR_DATE
and GIT_COMMITTER_DATE
from your shell's environment, allowing Git to fill in a default:
$ unset GIT_AUTHOR_DATE
$ unset GIT_COMMITTER_DATE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With