Use manual branch deploys for staging environment

Hey All

I’m trying to setup proper local, staging and production environments for our site - We’ve been doing these as a manual deploy - there’s an issue with the automated deploy process that I haven’t looked into fixing yet, though perhaps it’s time. Here are the steps I’ve tried - would love suggestions on how to get this working properly!

Manual Deploy to second site
I setup a second site on netlify (adorable-kringle-491f78) to act as our staging environment, with the intention of doing manual deploys of our staging branch to this site. I changed the production deploy branch to be staging.
Unfortunately when I run netlify deploy --prod on the staging branch locally, it doesn’t kick off a deploy. My assumption here is that the github branch is configured to push to and not the adorable-kringle one. Would love any advice/steps on how to get manual deploys to be able to send to a second site.

Setting up branch deploys on and using context environment variables
This would be the ideal best case scenario to get up and running. I’ve configured the staging branch as an additional deployment branch, however can’t seem to figure out how to do manual deploys to this branch - whenever I kick one off, it pushes out to the production website.

Let me know if I can provide anymore information

Hi @aashnisshah :wave:t6: ,

Please give this documentation a read and see if this helps you. Get started with Netlify CLI | Netlify Docs

Hey @SamO

Thanks for the reply! I read through that document earlier and took another look at it just now, unfortunately I don’t think it answers my question unless I’m misunderstanding it.

How can we do a manual deploy to a non-production branch? The document only shows how to deploy to production using the --prod flag
Unless we’re deploying to a directory folder or something else?

You can do this by running

netlify deploy --dir=<path/to/your/build/directory> --branch=<non-production-branch>

Thank you! This solved my problem for me and I now have my staging environment successfully deployed!

I took another scan of the page and didn’t see anything about --branch=<non-production-branch> in it. Perhaps the Netlify team can add it to their docs?

That’s a good call out and i’m glad your problem was solved.