I am setting up a new development environment which, on the surface, is the same as the environment I have on another computer:
- Windows 10
- WSL running AmazonLinux2
- Windows terminal
- git version 2.40.1
Using the terminal, I've staged a new set of changes, then type:
git commit -S -m "My commit message here"
Which returns this mmessage:
the input device is not a TTY
Checking git status shows that the staged changes remain uncommitted.
I've tried:
- Removing
-mand the message, hoping git will open vim - Removing the
-Sswitch - Running
--dry-run - All permutations of the above
- Configuring git's
core.terminalsetting tovi(which I believe is default, but hey, you never know)
When I Google the message, almost all of the results relate to Docker shells, and seem unrelated (most of the answers involve removing or altering the -it switches from a docker exec command). I do have Docker running, but the git command is not being run in a Docker instance.
Again, I do not have this issue on another computer with seemingly the same setup.
Update
I figured out the cause, and have found a way to work around it without actually solving it; see my own answer below.
Again, not a solution, as linting is there for a reason, obviously, but I was able to push up my changes, complete the task, and push off dealing with the error for another day. The question is still open.
This is not a solution to the cause of the error, but a workaround that allowed me to continue working.
git is configured on my machine with a preprocessor that runs GrumPHP to lint my code; the TTY error is being thrown by GrumPHP. I was able to disable it in order to make my commit, but the problem with GrumPHP remains.
For anyone with a similar problem who Googled your way here, if you have preprocessing configured in your commit flow, the scripts will be in the
.git/hooks/folder of your project. In my case, I edited.git/hooks/pre-commitand/.git/hooks/commit-msgand simply commented out the GrumPHP scripts.