在本地服务器上使用 Python 预提交

问题描述

我正在使用一个名为 pre-commit 的 Python 包来为我的团队标准化 git 工作流程。

由于公司与 github 的代理关系,我在使用此包 https://github.com/pre-commit/mirrors-mypy 设置预提交挂钩时遇到了一些问题。

我决定下载包并将其上传到我们本地的 bitbuket 服务器并设置预提交以将其用作本地存储库。

这是我的 .pre-commit-config.yaml 文件

# See https://pre-commit.com for more @R_776_4045@ion
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: http://localserver/scm/~username/local_mypy.git
    rev: '03f936cbf67'
    hooks:
    -   id: mypy

然后我运行 pre-commit install 并在我的 git bash 中运行

git commit -a -m"let's see if pre-commit works"

但我得到的结果是

[INFO] Installing environment for http://localserver/scm/~username/local_mypy.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('H:\\.cache\\pre-commit\\repo3yl4ty_p\\py_env-python3.6\\Scripts\\python.EXE','-mpip','install','.')
return code: 1
expected return code: 0
stdout:
    Processing h:\.cache\pre-commit\repo3yl4ty_p
    Could not fetch URL https://pypi.org/simple/mypy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',port=443): Max retries exceeded with url: /simple/mypy/ (Caused by SSLError(SSLError(1,'[SSL: UNKNowN_PROTOCOL] unkNown protocol (_ssl.c:833)'),)) - skipping

stderr:
    WARNING: retrying (Retry(total=4,connect=None,read=None,redirect=None,status=None)) after connection broken by 'SSLError(SSLError(1,)': /simple/mypy/
    WARNING: retrying (Retry(total=3,)': /simple/mypy/
    WARNING: retrying (Retry(total=2,)': /simple/mypy/
    WARNING: retrying (Retry(total=1,)': /simple/mypy/
    WARNING: retrying (Retry(total=0,)': /simple/mypy/
    ERROR: Could not find a version that satisfies the requirement mypy==0.800 (from pre-commit-dummy-package)
    ERROR: No matching distribution found for mypy==0.800

Check the log at H:\.cache\pre-commit\pre-commit.log

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)