tags:

views:

271

answers:

2

How would you accomplish this?

mkdir newbuild
cd newbuild
git init
git remote add origin git+ssh://user@host:22/var/www/vhosts/build
$ git checkout -b origin/mybranch
fatal: You are on a branch yet to be born
+3  A: 

What are you trying to do here? You don't have an origin remote, so you don't have any remote branches, so you can't create a local branch based off of one. You need to either clone the remote repository, or add it as your origin remote and then git fetch.

Of course, the error message is completely wrong. Ignore it.

Kevin Ballard
sorry, forgot to include the `git remote add` line
Andrei Serdeliuc
git-fetch did solve the issue. Thanks
Andrei Serdeliuc
You can also use `git remote update` to update all remote branches for all remotes.
Kevin Ballard
+2  A: 

I assume that origin's active/default branch isn't mybranch which is why a plain clone won't work. It might also be easier to just do this:

git clone -n git+ssh://user@host:22/var/www/vhosts/build newbuild
cd newbuild
git checkout -b origin/mybranch
Pat Notz