How Can I Switch a Public Repo to Private and Vice Versa on Github

Switching a Github repository from public to private or vice versa is a common operation that developers need to do frequently.

This can be done easily through the Github website.

In this tutorial, we’ll explore the steps required to switch a public repository to private and vice versa on Github.


Switching a Public Repository to Private

A public repository is visible to everyone and can be seen, forked, and cloned by anyone.

If you want to keep your code private and make it accessible only to you and the collaborators you invite, you can switch your public repository to private.

Here’s how:

  1. Go to your Github repository.
  2. Click on the “Settings” tab located in the top right corner of the page.
  3. Scroll down to the “Danger Zone” section and click on the “Make Private” button.
  4. A pop-up window will appear asking you to confirm the change. Click on the “Make Private” button to confirm.
  5. Your repository is now private and can only be accessed by you and the collaborators you invite.

Note that once you switch a repository to private, it cannot be changed back to public.

Switching a Private Repository to Public

If you want to make your private repository public, you can do so by following these steps:

  1. Go to your Github repository.
  2. Click on the “Settings” tab located in the top right corner of the page.
  3. Scroll down to the “Danger Zone” section and click on the “Make Public” button.
  4. A pop-up window will appear asking you to confirm the change. Click on the “Make Public” button to confirm.
  5. Your repository is now public and can be accessed by anyone.

Note that making a repository public means that all its code, issues, and pull requests will be visible to everyone, so be careful when making this change.


Conclusion

In conclusion, switching a Github repository from public to private or vice versa is a straightforward process that can be done easily through the Github website.

By following the steps outlined in this tutorial, you’ll be able to switch your repository to the privacy level that you prefer.