更新 Mac OS 后 Git 提交问题

发布于 2025-01-16 20:08:49 字数 436 浏览 4 评论 0原文

更新到最新版本后,我在 Mac 操作系统中收到以下提交错误。尝试重新启动 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

I am getting the below commit error in my Mac OS after updating to the latest version. Tried restarting VS Code and also tried to use terminal and same error. Until git add . step it works fine. Only the commit command is not working fine. What could be the issue?

enter image description here

 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

没有伤那来痛 2025-01-23 20:08:50

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

I found the issue. I removed the pre-commit file from the .git directory and that fixed the issue.

嘦怹 2025-01-23 20:08:49

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

选项:

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

The MacOs 12.3 update removed the built-in python 2.7 client.

Options:

  • install python 2.7 manually, for example from here
  • look into the pre-commit file: maybe it can be updated to use python3 (which would need to be installed then of course)
2025-01-23 20:08:49

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

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

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

The following code in the .git/hooks/pre-commit file throws python: command not found

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

The solution for me is as easy as update python to python3 in the pre-commit file since I have python3 installed on my Mac.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文