I am using git to download some files, I did ‘git init’ then
git pull https://myusername:mypass@github.com/Test/test.git
The thing is that I want to change the branch I am now at. From ‘master’ to ‘mybranch’.
I am executing git checkout 'mybranch' but I am getting this:
error: pathspec 'mybranch' did not match any file(s) known to git.
What is the error?
You aren’t setting up any remotes when you initialize an empty repository and issue a
git pull.If you want to use any/all of the remote branches in your repository, you should be using
git clone <remote>to create a local clone of the repo, rather thangit init; git pull <remote>which simply gives you a copy of the default branch from the remote.Once you’ve properly cloned the repository, assuming there is a remote branch
origin/mybranch, you can check out a local copy which will track the remote through your command: