4

I've been using the pre-commit tool for years! and it's worked great until recently when it started failing with a mysterious error message:

$ pre-commit run flake8 --all-files
An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='https://github.com/pre-commit/pre-commit-hooks')
=====> Missing required key: rev
Check the log at /home/asottile/.cache/pre-commit/pre-commit.log

how do I fix this?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207

1 Answers1

5

your particular case has been warning since may of 2019:

$ pre-commit run flake8 --all-files
[WARNING] Unexpected key(s) present on https://github.com/pre-commit/pre-commit-hooks: sha
flake8...................................................................Passed

you can fix your case by running pre-commit migrate-config which will update sha to rev:

$ pre-commit migrate-config
Configuration has been migrated.
$ pre-commit run flake8 --all-files
flake8...................................................................Passed

disclaimer: I wrote pre-commit

anthony sottile
  • 61,815
  • 15
  • 148
  • 207