【发布时间】:2020-08-19 21:01:22
【问题描述】:
当我运行时,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挂钩尝试运行git fetch origin --tags并未能通过身份验证。可以手动运行命令吗? -
感谢@phd,是的,我尝试手动运行它,它工作正常,拉新分支没有任何问题。
-
我的下一个想法更复杂——
pre-commit钩子使用sudo在不同的用户下运行命令,从而失去对 SSH 密钥的访问权限。但是如果不查看钩子的代码,就很难调试。 -
你是对的@phd!我修复了一些文件权限,虽然现在得到了这个,
An error has occurred: InvalidManifestError: =====> /Users/amit/.cache/pre-commit/repo29erukkj/.pre-commit-hooks.yaml does not exist Check the log at /Users/amit/.cache/pre-commit/pre-commit.log
标签: git pre-commit pre-commit.com