$ bash --noprofile
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ git --version
git version 2.34.1
bash-3.2$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: readme.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
tmp/
bash-3.2$ git commit -m 'initial'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
bash-3.2$ which omz # checking for oh-my-zsh
bash-3.2$ git rev-parse # no errors, so that's not it
bash-3.2$
我一直在用我的頭反對這個,現在是時候尋求幫助了。
直到昨天,Git 都運行良好,但我已經有幾周沒有在空倉庫中提交過了。嘗試升級git。使用/不使用zsh和 時,我都會遇到相同的錯誤oh-my-zsh。這個類似的問題,最好的答案是大約 9 歲,沒有幫助。提交--allow-empty導致同樣的錯誤。那里的其他答案也沒有幫助。
OSX 10.15.7
uj5u.com熱心網友回復:
這聽起來像是一個錯誤的 git hook 正在觸發,它正在參考git diff HEAD或某種型別的(可能是指使用git diff --staged --name-only)
確保檢查.git/hooks/*(可能.git/hooks/pre-commit)或者如果您配置了全域鉤子路徑還檢查的值git config core.hooksPath
獲取你的鉤子路徑:
git config --global core.hooksPath
檢查git rev-parse那里的任何鉤子,尤其是prepare-commit-msg.
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/371727.html
上一篇:命令列git命令突然要求輸入密碼
