Pushing to 'develop' still causes production deployment

I deployed an app from GitHub to Vercel using one of those automatic ‘deploy’ buttons. I take that this creates a connection to my repo that is managed by Vercel, as opposed to the typical GitHub actions deployment setup.

My app doesn’t have authentication hooked up and it has functionality that can cost me money, so I don’t want to want it exposed to the public yet.

So I don’t want to deploy to production - just preview since that has some protection.

In my Vercel project’s git settings I can see that I should simply avoid pushing to ‘main’ in order to avoid production deployments.

But when I push to develop, instead of main, it is still deploying to production.

What am I doing wrong? thanks.

Hi, @tom99!

Could you check your Vercel project settings?

  • Go to your project dashboard
  • Click on Settings, then Git
  • Make sure “Production Branch” is set to “main”

This tells Vercel not to deploy automatically when you push to the main branch. Any pushes to the production branch (e.g., “main”) create Production Deployments and pushes to other branches create Preview Deployments.

See relevant documentation for more details.

Could you give that a go and let us know how you get on?

1 Like

Hi pawlean.

Thanks for the response.

Yes, that spot in the project settings is where I focussed my attention. I had confirmed that my settings there are as expected and reviewed the linked docs. Your settings and docs are quite good. Appreciated.

I then made many changes to the project in my attempts to resolve the problem - to the point that anything I do there will no longer be reproducible. I will need to delete that project and re-create.

In the meantime I created a new project, making sure that it had both a main and a develop branch from the beginning. I created both a production and a preview deployment, deleted the production, and am now able to proceed with just the preview, as I wanted.

So, maybe I did something wrong with the first project? Not sure what. But I now do have things working as I want.

Thanks,
Tom

2 Likes

I’m glad it works for you now, @tom99! Let us know if we can help with anything else :smile:

If you haven’t already, feel free to drop by Introductions. Would love to hear more about what you’re up to!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.