error: pathspec 'test-branch' did not match any file(s) known to git

后端 未结 11 1786
刺人心
刺人心 2020-12-13 17:31

I am a new user of Git. I have forked a repository called Spoon-Knife (available for practicing forking with Git). Then, I cloned it locally by running

git c         


        
11条回答
  •  暖寄归人
    2020-12-13 17:46

    The modern Git should able to detect remote branches and create a local one on checkout.

    However if you did a shallow clone (e.g. with --depth 1), try the following commands to correct it:

    git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
    git fetch --all
    

    and try to checkout out the branch again.

    Alternatively try to unshallow your clone, e.g. git fetch --unshallow and try again.

    See also: How to fetch all remote branches?

提交回复
热议问题