I assume gatsby new expects a newer version of git. Perhaps all this needs is a doc update.
$ gatsby new tutorial-part-one https://github.com/gatsbyjs/gatsby-starter-hello-world
info Creating new site from git: https://github.com/gatsbyjs/gatsby-starter-hello-world.git
error: unknown option `single-branch'
usage: git clone [options] [--] <repo> [<dir>]
-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recursive initialize submodules in the clone
--template <path> path the template repository
--reference <repo> reference repository
-o, --origin <branch>
use <branch> instead of 'origin' to track upstream
-b, --branch <branch>
checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
error Command failed: git clone https://github.com/gatsbyjs/gatsby-starter-hello-world.git tutorial-part-one --single-branch
Hmm it seems the single-branch option was added in git 1.7.10 (which is a 6 year old release), and you have git 2.1.1. Could there be something else going on here?
Yes... you are correct. In isolation the command is successful. The error is misleading? I will dig a bit deeper then.
% git clone https://github.com/gatsbyjs/gatsby-starter-hello-world.git tutorial-part-one --single-branch
Cloning into 'tutorial-part-one'...
remote: Counting objects: 185, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 185 (delta 0), reused 2 (delta 0), pack-reused 181
Receiving objects: 100% (185/185), 326.56 KiB | 0 bytes/s, done.
Resolving deltas: 100% (86/86), done.
Checking connectivity... done.
Hi. So I modified init-starter.js to simply dump the version of git it is using and it report version 1.7.1. I tracked that down and apparently that is in my PATH and I was not aware. The version I use from the command line is actually an alias to the later version which means it was not picked up during execution of the tool. So this is my env issue. Closing this now.
Thanks for reporting back 馃憤
I have same issue.
Most helpful comment
I have same issue.