Install Pre-commit Hook for ESP-IDF Project
Python 3.8.* or above. This is our recommended Python version for ESP-IDF developers.
If you still have Python versions not compatible, update your Python versions before installing the pre-commit hook.
pip install pre-commit
Go to the ESP-IDF project directory.
pre-commit install --allow-missing-config -t pre-commit -t commit-msg. Install hook by this approach will let you commit successfully even in branches without the
pre-commit hook will run automatically when you are running
What Is More?
For detailed usage, please refer to the documentation of pre-commit.
Common Problems For Windows Users
/usr/bin/env: python: Permission denied.
If you are in Git Bash, please check the python executable location by run
If the executable is under
~/AppData/Local/Microsoft/WindowsApps/, then it is a link to Windows AppStore, not a real one.
Please install Python manually and update this in your
USERPROFILE contains non-ASCII characters
pre-commitmay fail when initializing an environment for a particular hook when the path of
pre-commit's cache contains non-ASCII characters. The solution is to set
PRE_COMMIT_HOMEto a path containing only standard characters before running pre-commit.
$Env:PRE_COMMIT_HOME = "C:\somepath\pre-commit"