Requiring tests to pass before a commit is allowed can be a negative experience as well. For instance if you're handing off a branch to someone else to take over work in progress because you're going on vacation.
Or if you just have the (good) habit of checking in your work in progress code frequently, or daily.
Or if you have several workstations you want to share code on.
Point is that commits should be frequent and requiring tests to pass before you can commit is guaranteed to make sure that commits are infrequent.
I prefer to put "tests must pass before PR can be merged", rather than before commits can be made.
It solves all of those issues.