解决fatal: cannot run .git/hooks/pre-commit: No such file or directory

问题原因

Mac系统更新12.3 版本以后,默认没有自带的python2,需要手动安装python3
python3路径与原来的自带python2的路径不一致,pre-commit 里访问不到

解决方案

进入工程目录
cd ./git/hooks
vim pre-commit
修改 #!/usr/bin/python
改为 #!/usr/local/bin/python3

查看python3位置命令

which python3

附录Mac配置python3环境变量

alias python='/usr/local/bin/python3'
export PATH=/usr/local/opt/python/libexec/bin:$PATH

你可能感兴趣的:(解决fatal: cannot run .git/hooks/pre-commit: No such file or directory)