user8785660
user8785660

Reputation:

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

I just create new git repository:

git init

and I've got response

Initialized empty Git repository in E:/...

Then I try to create new branch:

git checkout test

and got an error:

pathspec 'test' did not match any file(s) known to git.

I have no remote repository, no commits, and no idea what is wrong.

Upvotes: 1

Views: 2098

Answers (1)

ifma
ifma

Reputation: 3818

You need to create the branch first. git checkout -b test would create the branch and switch to it, or git branch test to just create it but not switch to the branch.

After doing this you will be able to switch to the branch via git checkout test as you are doing, but on its own it won't create the new branch.

This page would be informative for you: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

Upvotes: 3

Related Questions