GIT fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree

后端 未结 5 3208
一向
一向 2020-11-29 20:44

I\'m trying to initialize a new GIT repo from Debian (actually a VM on Virtualbox, installed and running on Mac OS X) :

[david@server-VM-001:~ $] mkdir test
         


        
5条回答
  •  孤独总比滥情好
    2020-11-29 21:39

    Jacob Helwig mentions in his answer that:

    It looks like rev-parse is being used without sufficient error checking before-hand

    Commit 62f162f from Jeff King (peff) should improve the robustness of git rev-parse in Git 1.9/2.0 (Q1 2014) (in addition of commit 1418567):

    For cases where we do not match (e.g., "doesnotexist..HEAD"), we would then want to try to treat the argument as a filename.
    try_difference() gets this right, and always unmunges in this case.
    However, try_parent_shorthand() never unmunges, leading to incorrect error messages, or even incorrect results:

    $ git rev-parse foobar^@
    foobar
    fatal: ambiguous argument 'foobar': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git  [...] -- [...]'
    

提交回复
热议问题