Can I use netlify dev --live before linking repo to Netlify?

I hope this isn’t a stupid question:

I’m developing a Gatsby site locally. I have it under version control and on a private Github repo. I don’t have full buy-in on Netlify and Gatsby from the boss yet and it would be awesome to use to use netlify dev --live to let the boss see a working prototype before putting the site on Netlify. I don’t want the site to be publicly accessible. Password protection would solve this problem for me, but again, I don’t have buy in just yet, so I can’t pony up for a paid account yet.

Is this possible?

Hi there, no, you can’t use --live without linking a site. That said, you don’t need to necessarily have a deploy in the repo, as long as the site was created and linked. Let me know if this helps!

Thanks for the reply @perry. How do you create a new Netlify site from Github without a deploy?

let me ask this way: if you create the repo on github but do not push to it, are you able to create the link?

I have a github repo. When I log into Netlify, I only see the option for “New Site From Git”.

Yup, that’s the default and the “happy path” our UI tries to guide you into, but you can instead choose to deploy a site in different ways:

  1. drag and drop - probably simplest, zip up a folder with some files in it and drag to that same screen showing the git button (there should be a dotted-line box at the bottom of that page, which you can drop content into). See https://www.netlify.com/docs/manual-deploys/ for more details.

  2. you can also deploy a site via our CLI (useful if you already have a site built locally): https://www.netlify.com/docs/cli

thanks, @fool. that’s cool.

but still I need some sort of commit to link a Netlify site to a git repo i have on a dev machine, correct? This is probably a bit of an edge case and I don’t think I’ll have too much trouble getting buy-in, so no biggie. I was just excited to try out Netlify dev --live but don’t want to push my whole repo to Netlify just yet.

Hmm, I don’t think you do need to do that. I think you can deploy with no git connection at all, just by running netlify sites:create from your local copy, and once you have that (local) content deployed, you can use netlify dev without any need for anything git-related.

Does netlify sites:create push my code up to Netflify where it would be public?

OK, cool. So if anyone has this specific case in the future (want to use netlify dev --live before deploying any code):

  1. use netlify sites:create from the CLI to create a site on netlify
  2. use netlify link and choose the name of the site you just created
  3. netlify dev --live now works without pushing your repo to Netlify

thanks for bearing with me!

2 Likes

Thanks for sharing your experience @jamesd1!