How to creat a site so can use local dev but no git

So I want to locally locally dev a new code spike.

But I have to link it to a site first.
But it’s not in git and so after much searching if found drop zone hidden away at bottom of page :frowning:
But my code is in Windows WSL and I can’t drag and drop form the CLI :frowning:

Is there a way to get code into a site without git or GUI file explorer?

I guess I’ll just create a GitHub repo.

Hi @slim

Sounds like you are wanting to use Netlify CLI

I agree but I started using “netlify dev” in the cli. That is what insists I have a site and then all the problems follow.

As far as I know I cannot create a site with the cli from the folder I am in. The docs all point to creating sites with the ui and using git.

But yes, I’ll explore the cli more in case there’s an option I missed.

I used to just use netlify dev in any folder to fire up a web server. That was really nice. But now it appears I cannot. Or perhaps it’s as I have a netlify.toml in this case?

netlify init will create a site for you from the command line. Once you have that, you can use netlify dev to test your site locally (including functions) and netlify deploy to send your site live.

No need to push to git. Builds and done locally and pushed live.

1 Like

Ah does it!!
Great!
Generally init commands just set up a local directory structure.

I suggest:

“Configure continuous deployment for a new or existing site”
=>
“Configure continuous deployment for a existing site or create a new site”

And possible add to GUI docs - though the CLI are not included there as options.

Thanks, will try

hold on - CI requires git integration and I was trying to just create the site as dev required me to link to one for local dev only.

It;'s all a little muddled IMHO

or perhaps it’s ME that is muddled - LOL

netlify init then you would select Yes, create and deploy site manually, select your team, enter a site name (or accept a random one) and that’s it.

netlify-init

It worked perfectly thanks and didn’t clobber the toml file as I feared it might.

So in summary the init command is great but the description in the online docs is confusing. It could say something like

Configure local build and dev to work in collaboration with a Netlify site if ione is not already linked. It will et up for manual deployment or CD with git and create and link to a new site in Netlify.

Yeah, it works perfectly. But the command name and online docs didn’t clue me in to what it does.

How about the build comment to use “link” also mention “init”?

Thanks very much

ie

“Error: Could not find the site ID. Please run netlify link.”

Error: Could not find the site ID. Please run netlify link or netlify init."

Glad it all worked for you @slim. I’ll make sure to bring your suggestions Netlify staff for consideration.

2 Likes

Hey there @slim and @coelmay :wave:

Thanks so much for sharing this feedback! I have surfaced it to our Docs team for review.

2 Likes

Hi :wave:

Adding to this already great thread:

  1. To only create a site you can use netlify sites:create (the init command actually uses the create command under the hood)
  2. You shouldn’t need to link a site to use netlify dev and it even works offline (via the --offline flag). If a site is linked it will read various site settings like env variables, publish directory, etc, but that’s not required for it to work.

@slim one possible issue I can think of is that the project might be linked to a site that no longer exists. In that case netlify dev will try to access the site settings and fail. You should be able to unlink it by running netlify unlink.

If that doesn’t work I recommend opening an issue on the CLI repo so we can investigate why this doesn’t work.

@KyleBlankRollins I’ll add my thoughts on the CLI docs issue you opened.

3 Likes

@erez for the tip.

You shouldn’t need to link a site to use netlify dev and it even works offline

agree. That was my bad mixing up the dev and build in my post :frowning:

Thanks for the response @slim, that makes sense. netlify build has an --offline flag too (it was added recently).