OK for security reasons, you cannot just convert a forked repo that was private into a public repo. I think the reason is the original repo might have contents that you do not want out in the public domain. But, if you have made a mistake and just want to force it to be public, there is a way to do this as explained by Github Help. But it doesn’t explain how you create a new repo in the first place. Fortunately, the command line tools gh.
The main reason for doing this is that if you are using the free netlify hosting, they changed their policy so you get free automatic pushes only if it is from a public repo. For a typical startup, the website is nothing special or interesting, so as long as you copyright it, it is fine if it is a public repo. You can get a typical closed-source license from Github itself of course.
So here are the steps:
Convert from Forked Private to Public Repo
- First, you want to create a new repo and give it the right permissions
- Then you create what is called a bare repo, which downloads all the strange things that git uses to keep track of things
- Then you do a git lfs fetch so that all the items in Git LFS are copied down and the pointers have real data objects
- Finally, you do a push with a –mirror to the new repo which takes all the artifacts and you will get a clone with all the commits there.
- And then you also push all the git lfs objects into the new repo
So a sample set of commands are:
gh repo create git@github.com:organization/new-repository --public
git clone --bare git@github.com:organization/old-repository
cd old-repository.git
git lfs fetch --all
git push --mirror git@github.com:organization/new-repository
git lfs push --all git@github.com:organization/new-repository
Change the pointer for Netlify to a new repo
Now you can go to Netlify and then choose Deploy and Repository and manage and then you authenticate and select the public repo and it should just start to build