Make gatsby new clone using https instead of ssh
See original GitHub issueDescription
When initiating a project with the gastby new command, the project could be cloned with https, as in some environments/companies cloning using git/ssh is not supported.
Environment
Gatsby version: 1.1.28 Node.js version: v8.9.1 Operating System: Windows 7 SP1
Actual result
$ gatsby new gatsby-site
info Creating new site from git: git://github.com/gatsbyjs/gatsby-starter-default.git
Cloning into 'gatsby-site'...
fatal: Unable to look up github.com (port 9418) (Unknown host)
error Command failed: git clone git://github.com/gatsbyjs/gatsby-starter-default.git gatsby-site --single-branch
Error: Command failed: git clone git://github.com/gatsbyjs/gatsby-starter-defa ult.git gatsby-site --single-branch
- index.js:236 Promise.all.then.arr
[global]/[gatsby-cli]/[execa]/index.js:236:11
- util.js:16 tryCatcher
[global]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[global]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[global]/[bluebird]/js/release/promise.js:569:18
- promise.js:614 Promise._settlePromise0
[global]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[global]/[bluebird]/js/release/promise.js:693:18
- promise.js:638 Promise._fulfill
[global]/[bluebird]/js/release/promise.js:638:18
- promise_array.js:126 PromiseArray._resolve
[global]/[bluebird]/js/release/promise_array.js:126:19
- promise_array.js:144 PromiseArray._promiseFulfilled
[global]/[bluebird]/js/release/promise_array.js:144:14
- promise.js:574 Promise._settlePromise
[global]/[bluebird]/js/release/promise.js:574:26
- promise.js:614 Promise._settlePromise0
[global]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[global]/[bluebird]/js/release/promise.js:693:18
- async.js:133 Async._drainQueue
[global]/[bluebird]/js/release/async.js:133:16
- async.js:143 Async._drainQueues
[global]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues
[global]/[bluebird]/js/release/async.js:17:14
The error message is correct, there is no access to github directly as all traffic goes through an http proxy.
Expected behavior
https should be used to clone the starter as it works everywhere instead of git.
Steps to reproduce
1. Set up an environment where you cannot access to github.com with ssh/git
2. Run gatsby new gatsby-site
Suggested change
Replace hostInfo.git() by hostinfo.https() in https://github.com/gatsbyjs/gatsby/blob/af5c9c86a604d2f6d441a793d1df3cd7b2cba793/packages/gatsby-cli/src/init-starter.js#L69
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to clone Git Repository using HTTPS and SSH - YouTube
0:00 · New ! Watch ads now so you can enjoy fewer interruptions. Got it.
Read more >How to Utilize Submodules within Git Repos - Bits and Pieces
This lets you clone another repository into your project but still keep your commits to that project separate. Sounds handy, right? Let me...
Read more >Deploy a Gatsby site · Cloudflare Pages docs
In this guide, you will create a new Gatsby application and deploy it using Cloudflare Pages. You will be using the gatsby CLI...
Read more >Clone | Docs | Buddy: The DevOps Automation Platform
CloningUsing HTTPSUsing SSH Authentication with personal API tokensGenerating a ... Click Add a new API token and enter your password to create the...
Read more >Get started with Netlify CLI
In order to connect your repository for continuous deployment, Netlify CLI will need access to create a deploy key and a webhook on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me the above command didnt work, but the below command did the trick,
git config --global url."https://github.com/".insteadOf "git@github.com:"
Actually, I don’t think we need to change anything in gatsby
Git already provides a way to rewrite urls :
git config --global url."https://github.com".insteadOf git://github.com
(The trick was found on https://stackoverflow.com/questions/21260689/force-bundle-install-to-use-https-instead-of-git-for-github-based-gems )
Let’s just close this issue 😃