From 92a7dd8e3ec785c065780ca4ceccb034cf3af0b2 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Sat, 27 Jan 2018 09:31:36 -0800 Subject: [PATCH] If someone uses a private repo git address accessed over ssh use that otherwise use normal git address --- packages/gatsby-cli/src/init-starter.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-cli/src/init-starter.js b/packages/gatsby-cli/src/init-starter.js index 87cfcae8869fe..142e6fc00c364 100644 --- a/packages/gatsby-cli/src/init-starter.js +++ b/packages/gatsby-cli/src/init-starter.js @@ -66,7 +66,15 @@ const copy = async (starterPath: string, rootPath: string) => { // Clones starter from URI. const clone = async (hostInfo: any, rootPath: string) => { - const url = hostInfo.ssh({ noCommittish: true }) + let url + // Let people use private repos accessed over SSH. + if (hostInfo.getDefaultRepresentation() === `sshurl`) { + url = hostInfo.ssh({ noCommittish: true }) + // Otherwise default to normal git syntax. + } else { + url = hostInfo.git({ noCommittish: true }) + } + const branch = hostInfo.committish ? `-b ${hostInfo.committish}` : `` report.info(`Creating new site from git: ${url}`)