Git: cannot checkout branch - error: pathspec '…' did not match any file(s) known to git

后端 未结 30 3364
太阳男子
太阳男子 2020-11-27 23:54

I\'m not sure why I\'m unable to checkout a branch that I had worked on earlier. See the commands below (note: co is an alias for checkou

30条回答
  •  庸人自扰
    2020-11-28 00:49

    I fixed it by modifying my git config file Check your the config file in your git directory - .git\config

    It previously had

    [remote "origin"]
    url = http://git.xyz.com/abc-group/pqr.git
    fetch = +refs/heads/develop:refs/remotes/origin/develop
    

    I fixed by modifying it to

    [remote "origin"]
    url = http://git.xyz.com/abc-group/pqr.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    

    Notice the head was pointing to only one branch, so it couldnt find the reference to other existing branches, I changed it to * so it checks everything in origin.

提交回复
热议问题