Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission error in pre-commit hook #22

Open
benrady-aq opened this issue Jun 21, 2024 · 1 comment
Open

Permission error in pre-commit hook #22

benrady-aq opened this issue Jun 21, 2024 · 1 comment

Comments

@benrady-aq
Copy link
Collaborator

git commit -am "Adding newlines"
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check toml...........................................(no files to check)Skipped
check json...........................................(no files to check)Skipped
check for added large files..............................................Passed
mixed line ending........................................................Passed
detect private key.......................................................Passed
check for merge conflicts................................................Passed
pyupgrade............................................(no files to check)Skipped
autoflake............................................(no files to check)Skipped
hatch fmt................................................................An unexpected error has occurred: PermissionError: [Errno 13] Permission denied: '/usr/local/hatch/bin/hatch'
Check the log at /Users/brady/.cache/pre-commit/pre-commit.log
brady ~/benrady-src/alogamous (add-benrady) [0s]% cat /Users/brady/.cache/pre-commit/pre-commit.log
### version information


pre-commit version: 3.7.1
git --version: git version 2.39.3 (Apple Git-146)
sys.version:
    3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]
sys.executable: /Users/brady/benrady-src/alogamous/.venv/pre-commit/bin/python
os.name: posix
sys.platform: darwin


### error information


An unexpected error has occurred: PermissionError: [Errno 13] Permission denied: '/usr/local/hatch/bin/hatch'

Traceback (most recent call last):
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/main.py", line 389, in main
    return hook_impl(
           ^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/commands/hook_impl.py", line 271, in hook_impl
    return retv | run(config, store, ns)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/commands/run.py", line 444, in run
    return _run_hooks(config, hooks, skips, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/commands/run.py", line 296, in _run_hooks
    current_retval, prior_diff = _run_single_hook(
                                 ^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/commands/run.py", line 193, in _run_single_hook
    retcode, out = language.run_hook(
                   ^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/lang_base.py", line 187, in basic_run_hook
    return run_xargs(
           ^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/lang_base.py", line 170, in run_xargs
    return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/xargs.py", line 151, in xargs
    cmd = parse_shebang.normalize_cmd(cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/parse_shebang.py", line 80, in normalize_cmd
    cmd = parse_filename(exe) + (exe,) + cmd[1:]
          ^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/pre_commit/parse_shebang.py", line 19, in parse_filename
    return parse_shebang_from_file(filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/brady/benrady-src/alogamous/.venv/pre-commit/lib/python3.12/site-packages/identify/identify.py", line 213, in parse_shebang_from_file
    with open(path, 'rb') as f:
         ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/usr/local/hatch/bin/hatch'

@benrady-aq
Copy link
Collaborator Author

Fixed by running

sudo chmod a+r /usr/local/hatch/bin/hatch
Password:
brady ~/benrady-src/alogamous (add-benrady) [5s]% git commit -am "Adding newlines"
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check toml...........................................(no files to check)Skipped
check json...........................................(no files to check)Skipped
check for added large files..............................................Passed
mixed line ending........................................................Passed
detect private key.......................................................Passed
check for merge conflicts................................................Passed
pyupgrade............................................(no files to check)Skipped
autoflake............................................(no files to check)Skipped
hatch fmt................................................................Passed
[add-benrady addc52d] Adding newlines
 6 files changed, 6 insertions(+), 6 deletions(-)

We should add this to the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant