github GUI client /dev/tty: Device not configured

git, github, github-for-mac

Solution

Your gui client does not provide a tty or any other way of getting input from the user during hooks. So this is not possible. I see two solutions to this problem:

- Let the commit pass and output a warning. Getting back to the previous state is as simple as `git reset HEAD^`.

- Use a git config option to either toggle the check or configure a list of valid pom files.

Problem

I have this pre-commit hook in .git/hooks/pre-commit ``` #!/bin/bash for file in `git diff --name-only` do if [[ $file =~ /pom\.xml$ ]]; then exec < /dev/tty read -p "Committing $file is often a mistake; are you sure you want to do that? (Y/[N]): " ans exec <&- if [[ $ans =~ ^[Yy]$ ]]; then echo proceeding rashly with commit... else echo aborting commit, O prudent one. exit 1 fi fi done ``` When I use github for mac (GUI client) to commit, it shows this error: ``` .git/hooks/pre-commit: line 5: /dev/tty: Device not configured aborting commit, O prudent one. (1) ``` It works on command line. But I hope to get the GUI client to work. Any ideas? Thanks!

Original source