pre-commit-hooks icon indicating copy to clipboard operation
pre-commit-hooks copied to clipboard

CalledProcessError: unable to access 'https://github.com/pre-commit/pre-commit-hooks/

Open LanCole opened this issue 1 year ago • 2 comments

search you tried in the issue tracker

CalledProcessError

pre-commit --version

2.17.0

describe the issue

When I use pre-commit run typos --all-file to check the code, an error message has occurred, as shown below:

[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Failed to connect to github.com port 443 after 75010 ms: Couldn't connect to server
 
Check the log at /Users/XXXXX/.cache/pre-commit/pre-commit.log

The log in the pre-commit.log

version information

pre-commit version: 2.17.0
git --version: git version 2.39.3 (Apple Git-146)
sys.version:
    3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:07:17) [Clang 14.0.6 ]
sys.executable: /opt/anaconda3/bin/python
os.name: posix
sys.platform: darwin

error information

An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Failed to connect to github.com port 443 after 75010 ms: Couldn't connect to server
    
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 183, in clone_strategy
    self._shallow_clone(ref, _git_cmd)
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 165, in _shallow_clone
    git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 180, in _git_cmd
    cmd_output_b('git', *args, cwd=directory, env=env)
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/util.py", line 154, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/git', '-c', 'protocol.version=2', 'fetch', 'origin', 'v4.4.0', '--depth=1')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Failed to connect to github.com port 443 after 75009 ms: Couldn't connect to server
    

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/error_handler.py", line 70, in error_handler
    yield
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/main.py", line 396, in main
    return run(args.config, store, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/commands/run.py", line 403, in run
    for hook in all_hooks(config, store)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/repository.py", line 228, in all_hooks
    return tuple(
           ^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/repository.py", line 231, in <genexpr>
    for hook in _repository_hooks(repo, store, root_config)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/repository.py", line 206, in _repository_hooks
    return _cloned_repository_hooks(repo_config, store, root_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/repository.py", line 172, in _cloned_repository_hooks
    manifest_path = os.path.join(store.clone(repo, rev), C.MANIFEST_FILE)
                                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 187, in clone
    return self._new_repo(repo, ref, deps, clone_strategy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 144, in _new_repo
    make_strategy(directory)
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 185, in clone_strategy
    self._complete_clone(ref, _git_cmd)
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 157, in _complete_clone
    git_cmd('fetch', 'origin', '--tags')
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/store.py", line 180, in _git_cmd
    cmd_output_b('git', *args, cwd=directory, env=env)
  File "/opt/anaconda3/lib/python3.12/site-packages/pre_commit/util.py", line 154, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Failed to connect to github.com port 443 after 75010 ms: Couldn't connect to server

I would like to inquire about the problem and how to solve it here. I would greatly appreciate your response.

LanCole avatar Jan 11 '25 17:01 LanCole

The computer network is normal, so I am confused about the error here

LanCole avatar Jan 11 '25 17:01 LanCole

I can't help you with networking issues sorry

asottile avatar Jan 11 '25 17:01 asottile