繁体   English   中英

更新 Mac OS 后的 Git 提交问题

[英]Git commit issue after updating Mac OS

更新到最新版本后,我的 Mac OS 中出现以下提交错误。 尝试重新启动 VS Code 并尝试使用终端和相同的错误。 直到git add . 步骤它工作正常。 只有提交命令不能正常工作。 可能是什么问题?

在此处输入图像描述

 git commit -m "Commit message"
.git/hooks/pre-commit: line 15: python: command not found
.git/hooks/pre-commit: line 16: python: command not found

MacOs 12.3 更新删除了内置的 python 2.7 客户端。

选项:

  • 手动安装 python 2.7,例如从这里
  • 查看预提交文件:也许可以将其更新为使用 python3(当然需要安装)

.git/hooks/pre-commit文件中的以下代码抛出python: command not found

else
  # Linux / Mac
  python ${HOOKS_DIR}/detect_remote
  python ${HOOKS_DIR}/detect_secret
fi%  

对我来说,解决方案就像在预提交文件中将python更新为python3一样简单,因为我的 Mac 上安装了python3

我发现了这个问题。 我从.git目录中删除了pre-commit文件并解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM