Gatsby: [gatsby-cli] Don't create .git if project is created into existing git repo

Created on 26 Mar 2019  路  6Comments  路  Source: gatsbyjs/gatsby

I'm on an existing git repo and run gatsby new mysite.
Generating a nested .git folder for the gatsby site was confusing me as I couldn't add the newly generated site to git which though it was a git submodule or something...

Follow-up of conversation with @KyleAMathews here https://twitter.com/kylemathews/status/1110276125345775616

bug

Most helpful comment

I just went through this and ended up here from a Google search. I'm not sure if this is a good way to go but here's what I did:

  1. Create a project in GitHub
  2. Clone to local machine
  3. Run gatsby new gatsby-projectname in a separate directory (could probably go anywhere)
  4. Copy everything except the .git and node_modules directories into projectname
  5. Run npm install from the projectname directory to get all packages installed
  6. Copy node_modules/@babel into the projectname directory (to resolve a Cannot find module '@babel/preset-env' error which could've been self-inflicted)

I think that sets everything up, but please let me know if there's anything that I should check to make sure. From what I could tell it's working, and I was able to run a gatsby develop to test and gatsby build ran without any errors.

gatsby -v
Gatsby CLI version: 2.11.14
Gatsby version: 2.20.25

All 6 comments

can i work on this?

@mayaarguelles that'd be great, thanks!

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 馃挭馃挏

@mayaarguelles curious if you've had any time to work on this?

google took me to this issue. How do I tell gatsby cli to create a project inside an existing git dir without creating a subdirectory? Similar to create-react-app .

My steps:

  1. Create a project in github/gitlab
  2. Clone to local machine
  3. If I run gatsby new my-site inside the new project, my-site is created as a subdir. If I run it outside I'd get the error below
gatsby new ./leanstack-landing
info Creating new site from git:
fatal: destination path './leanstack-landing' already exists and is not an empty directory.

 ERROR

Command failed with exit code 128: git clone https://github.com/gatsbyjs/gatsby-starter-default.git ./leanstack-landing --depth=1

gatsby -v
Gatsby CLI version: 2.10.13
Gatsby version: 2.19.45

I just went through this and ended up here from a Google search. I'm not sure if this is a good way to go but here's what I did:

  1. Create a project in GitHub
  2. Clone to local machine
  3. Run gatsby new gatsby-projectname in a separate directory (could probably go anywhere)
  4. Copy everything except the .git and node_modules directories into projectname
  5. Run npm install from the projectname directory to get all packages installed
  6. Copy node_modules/@babel into the projectname directory (to resolve a Cannot find module '@babel/preset-env' error which could've been self-inflicted)

I think that sets everything up, but please let me know if there's anything that I should check to make sure. From what I could tell it's working, and I was able to run a gatsby develop to test and gatsby build ran without any errors.

gatsby -v
Gatsby CLI version: 2.11.14
Gatsby version: 2.20.25

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jimfilippou picture jimfilippou  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

andykais picture andykais  路  3Comments

magicly picture magicly  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments