'How can I switch a public repo to private and vice versa on GitHub?

I can't seem to find a way to do this. Is it possible at all? Since this is kind of important in my case, is there a code management platform where this is possible?



Solution 1:[1]

To switch a repository on GitHub from public to private, or vice versa, follow these instructions:

  1. Go to your repository on GitHub
  2. Go to the "Settings" tab
  3. Scroll all the way down to the section labeled "Danger Zone"
  4. To change the public/private state of the repository:
    1. To make it private: Click the button labeled "Make Private" and follow the instructions
    2. To make it public: Click the button labeled "Make Public" and follow the instructions

Solution 2:[2]

Type the name of the repository that you want to make private, for example accountname/reponame. Example : User/Appname so it will enable button to do changes so and so.

Reference: https://docs.github.com/en/enterprise/2.19/user/github/administering-a-repository/setting-repository-visibility

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lasse V. Karlsen
Solution 2 Swift