git - Git 提交被拒绝,但与 --no-verify 一起使用
问题描述
当我运行git commit -m 'Test'
时,收到此消息:
[INFO] Initializing environment for git@github.com:humitos/mirrors-autoflake.git.
An unexpected error has occurred: CalledProcessError: command: ('/usr/local/git/libexec/git-core/git', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Check the log at /Users/amit/.cache/pre-commit/pre-commit.log
但如果运行,git commit -m 'Test' --no-verify
它工作正常。我的预提交钩子有问题,有什么想法吗?
解决方案
您的文件似乎.pre-commit-config.yaml
使用 ssh url 引用了 git 存储库,但您没有配置 github 的 ssh 密钥
您可以安全地替换对repo: git@github.com:humitos/mirrors-autoflake
with的引用repo: https://github.com/humitos/mirrors-autoflake
(特别是因为这是一个公共存储库)
推荐阅读
- pandas - 根据索引级别为多索引数据框分配值
- typoscript - Typo3 CMS 8.7 - 如何同时使用流体和网格元素?
- node.js - 如何从 API Nodejs + Expressjs 提交 html 表单
- spring-cloud-skipper - 将包上传到船长时出现“没有可用于'null'的发布管理器”春季云船长错误
- google-cloud-platform - GCP Cloud Run:创建服务失败
- sql - 使用多个条件格式化数据透视数据
- java - 如何将 VarChar 转换为整数?
- python - 我们如何使用 Selenium Python 以其他用户身份打开 Google chrome?
- visual-studio-code - 在 VSCode 上安装 Prettier
- apache-spark - 如何从 QlikView 连接到 Databricks Delta 表?