Migrate netlify github repo connect to netlify cli2023-09-28

Deploy with Git was an awesome feature provided by Netlify which can do continuous deployment by connecting a Git repository and keeping them in sync.

It was a breeze since it was easy to set up. but things become complex when they make a few changes: the private repository won’t work unless you upgrade to Pro plan or make the repository public.

Here are options you can do from the official suggestions:

⚠️ Organization-owned private repository detected

To keep building this site, you have a few options:

* Upgrade to Pro. The first month is free.
  https://app.netlify.com/teams/xxxxx/billing/pricing?plan=trial

* Build locally and deploy using Netlify CLI or drag and drop.
  https://docs.netlify.com/site-deploys/create-deploys/#netlify-cli

* Transfer the repo to a personal account or make the repo public,
  then push a new commit to send your new repo settings to Netlify.
  https://github.com/xxxxx/xxxx/settings#danger-zone

For more information, including how to get help, visit the FAQ page:
https://www.netlify.com/pricing/private-org-repo-faq
---------------------------------------------------------------------

After glance at these options, I end up with netlify-cli, which you can

  1. Just deploy from your local machine
  2. Set up CI on GitHub Action

Simply install netlify-cli, login and link the project.

You can either login or put a PAT in your .env, I chose PAT.

$ yarn add netlify-cli -D
$ yarn netlify link
$ yarn netlify deploy --prod

That’s it, happy coding.