Cloning a branch : Remote branch branch-99 not found in upstream origin
branch-99
does not exist on the remote repository. You probably misspelled the branch name or the repository.
To check which branches exist, use ls-remote
. You can use it on the remote...
git ls-remote --heads origin
Or if you haven't already cloned the repository, on a URL.
git ls-remote --heads [email protected]:Christoffer/admin.git
You'll get the commit IDs and branch names, but they'll be full references like refs/heads/<branch>
.
8c2ac78ceba9c5265daeab1519b84664127c0e7d refs/heads/fix/that
6bc88ec7c9c7ce680f8d69ced2e09f18c1747393 refs/heads/master
83f062226716bb9cebf10779834db1ace5578c50 refs/heads/branch-42
See gitrevisions
for more.
To be clear, git clone -b branch-99 [email protected]:Christoffer/admin.git
clones the entire repository. It just checks out branch-99
rather than master
. It's the same as...
git clone [email protected]:Christoffer/admin.git
git checkout branch-99
That bit of syntax sugar isn't worth the bother. I guess it might save you a tiny bit of time not having to checkout master.
If you want to clone just the history of one branch to save some network and disk space use --single-branch
.
git clone --single-branch -b branch-99 [email protected]:Christoffer/admin.git
However it's usually not worth the trouble. Git is very disk and network efficient. And the whole history of that branch has to be cloned which usually includes most of the repository anyway.
git clone [email protected]:Christoffer/admin.git
git checkout branch-99