I have the same repository locally that I want to deploy in 2 different Netlify accounts.
When I build the app, I build for development as well as production, from the same local repository. Both of them differs by environment variables and some other setup.
Development one is for my personal development and experiments, and is in my personal email address. Whereas the production version is through a company’s email.
After building the app, I do “netlify deploy -p”. However, since I am using 2 different Netlify accounts, but there is only 1 “siteId” linked to the local folder, I am unable to deploy when I switch the netlify account due to Permission error.
Error: Not authorized to view the currently linked site (XX-XX)
How do I add the other “siteId” from the other Netlify account, so I can netlify deploy with the other account by simply switching over to it?
Ideally, what I want to do is:
- netlify switch → change the account
- It should also change the linked siteId
- netlify deploy → deploys the site