Home > Mobile >  How to solve "git checkout branch" did not match any file(s) known to git?
How to solve "git checkout branch" did not match any file(s) known to git?

Time:09-16

There is a repository on bitbucket and I have a branch.

When I write: git branch -a, I get only my current branch and it doesn't list other branches.

When I write git checkout branch_name, I get: error: pathspec 'branch_name' did not match any file(s) known to git.

git remote show origin:

* remote origin
  Fetch URL: ssh:URL
  Push  URL: ssh:URL
  HEAD branch: master
  Remote branch:
    branch_name tracked
  Local branch configured for 'git pull':
    branch_name merges with remote branch_name
  Local ref configured for 'git push':
    branch_name pushes to branch_name (up to date)

git branch --all -vv

* branch_name                {an id} [origin/branch_name] A commit
  remotes/origin/branch_name {an id} A commit

CodePudding user response:

The problem is that when you cloned this repo, you made a single-branch clone. So the branch that you asked for is the only branch you can see.

(For "solutions", see How do I "undo" a --single-branch clone? .)

  •  Tags:  
  • git
  • Related