Skip to content

Running pre-commit 1.20.0 on Guix gives server certificate verification failed. CAfile: none CRLfile: none #1253

Closed

Description

@igankevich

Running pre-commit 1.20.0 on Guix gives

An unexpected error has occurred: CalledProcessError: Command: ('/home/igankevich/.guix-profile/bin/git', 'fetch', 'origin', '--tags')
Return code: 128
Expected return code: 0
Output: (none)
Errors:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': server certificate verification failed. CAfile: none CRLfile: none

Traceback (most recent call last):
  File "/gnu/store/35ppc0zpffbzc6zsw9xnks1hxmr7wh19-python-pre-commit-1.20.0/lib/python3.7/site-packages/pre_commit/store.py", line 168, in clone_strategy
    self._shallow_clone(ref, _git_cmd)
  File "/gnu/store/35ppc0zpffbzc6zsw9xnks1hxmr7wh19-python-pre-commit-1.20.0/lib/python3.7/site-packages/pre_commit/store.py", line 150, in _shallow_clone
    git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
  File "/gnu/store/35ppc0zpffbzc6zsw9xnks1hxmr7wh19-python-pre-commit-1.20.0/lib/python3.7/site-packages/pre_commit/store.py", line 165, in _git_cmd
    cmd_output_b('git', *args, cwd=directory, env=env)
  File "/gnu/store/35ppc0zpffbzc6zsw9xnks1hxmr7wh19-python-pre-commit-1.20.0/lib/python3.7/site-packages/pre_commit/util.py", line 147, in cmd_output_b
    returncode, cmd, retcode, output=(stdout_b, stderr_b),
pre_commit.util.CalledProcessError: Command: ('/home/igankevich/.guix-profile/bin/git', '-c', 'protocol.version=2', 'fetch', 'origin', 'v2.4.0', '--depth=1')
Return code: 128
Expected return code: 0
Output: (none)
Errors:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': server certificate verification failed. CAfile: none CRLfile: none

It looks like pre-commit sanitises GIT_SSL_CAINFO environment variable. Guix uses this variable to specify the path to the certificates. I fixed this bug by whitelisting GIT_SSL_CAINFO in no_git_env in pre_commit/git.py.

Activity

  1. asottile commented on Dec 25, 2019

    @asottile
    Member

    would you like to provide a patch? should be an easy fix as you've already found 👍

  2. asottile commented on Jan 2, 2020

    @asottile
    Member

    This has been released as part of v1.21.0 -- thanks again for the issue and PR 🎉!

  3. igankevich commented on Jan 3, 2020

    @igankevich
    Author

    Great! I can finally update guix package 👍

  4. added a commit that references this issue on May 9, 2020
    ffe83a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions