What changing GitHub visibility means and when you need to do it

A GitHub repository's visibility setting controls who can see your code. Private means only you and people you invite can view it. Public means anyone on the internet can see it, though only you and collaborators you add can change it. You might start a project private while you're building it, then make it public when it's ready to share. Or you might have a public project and need to make it private for security reasons.

Changing visibility is a one-time setting you control in your repository's settings page. GitHub doesn't charge differently based on visibility — the difference is purely about who can see your work. The change takes effect when ready, and you can switch back and forth as often as you need.

Key Takeaways

  • You change visibility by going to your repository's Settings tab, scrolling to the Danger Zone section, and clicking Change Repository Visibility.
  • Making a repository public means anyone can view your code and fork it, but only people you add as collaborators can push changes.
  • Making a repository private removes it from public view, but existing forks that other people created stay public unless they change their own settings.
  • You must be the repository owner or have admin permissions to change visibility — collaborators with write access cannot do this.

Steps to change visibility on GitHub.com

Start by opening your repository on GitHub and clicking the Settings tab near the top right of the page. You'll see a left sidebar with options like Code, Collaborators, and Branches. Scroll down that sidebar until you reach the Danger Zone section — it has a red background and sits near the bottom.

In the Danger Zone, find the option that says Change Repository Visibility. Click the button next to it. A dialog box will appear asking you to confirm the change and showing you what will happen. Read the message carefully — it will tell you whether you're making the repository public or private, and it will warn you about any side effects (like existing forks staying public if you're making your repo private). Type the repository name exactly as shown to confirm, then click the button to complete the change.

GitHub will process the change when ready. Refresh the page and go back to Settings to verify the new visibility appears in the Danger Zone section. If you're making a repository public, your code will be searchable and visible within a few minutes. If you're making it private, public access stops right away, though search engines may take longer to remove cached versions.

Understanding what happens to forks and collaborators

If you make a public repository private, any forks that other people created will remain public. This is by design — people who forked your work own their own copies. Making your original repository private doesn't affect theirs. If you're concerned about this, you can contact the people who forked your work and ask them to delete their forks, but you cannot force them to do so.

Collaborators you've added to your repository keep their access level regardless of visibility change. If someone had write access when the repository was public, they still have write access after you make it private. If you want to remove someone's access, you need to go to the Collaborators section in Settings and remove them separately.

If you make a private repository public, anyone with the link can view it, but only people you've added as collaborators can make changes. Existing collaborators keep their access level — you don't need to re-add them.

Visibility settings for organizations and teams

If your repository belongs to an organization rather than your personal account, the visibility change process is the same, but the permissions work differently. You need to be an organization owner or have admin access to the specific repository to change its visibility. Organization members with write access cannot make this change.

Some organizations have policies that restrict whether repositories can be made public. If you see a message saying you don't have permission to change visibility, contact your organization administrator — they may have locked this setting or require approval before public repositories are created.

Reasons to keep a repository private during development

Many developers keep repositories private while building because it gives you space to work without pressure. Your commit history, incomplete features, and debugging notes stay hidden. Once the project reaches a stable point or you're ready to share it, you can make it public.

Private repositories are also useful for work projects, client code, or anything containing sensitive information like API keys or credentials. Even though you should never commit secrets to any repository, private visibility adds a layer of protection while you're developing. If you accidentally commit something sensitive, making the repository private limits who has already seen it.

What to do if you can't change visibility

If the Change Repository Visibility button is grayed out or missing, you likely don't have the required permissions. Check that you're logged into the account that owns the repository. If it's an organization repository, confirm you're an organization owner or have admin access to that specific repository.

If you're certain you have the right permissions but the button still doesn't appear, try logging out and logging back in. Sometimes GitHub's interface doesn't refresh permissions when ready. If the problem persists, you can contact GitHub Support through your account settings — they can verify your permissions and help troubleshoot.

Frequently Asked Questions

Can I make a repository public and then private again?

Yes, you can change visibility as many times as you need. There's no limit on how often you switch between public and private. Each change takes effect when ready, though search engines and cached versions may take time to update.

What happens to pull requests and issues when I change visibility?

Pull requests and issues stay with the repository. If you make a repository private, people who previously had access to those pull requests can no longer see them unless you add them as collaborators. If you make a repository public, all pull requests and issues become visible to anyone.

Do I need to change visibility on GitHub Desktop or the command line?

No. Visibility is a GitHub.com setting only. You change it through the website in your repository's Settings tab. GitHub Desktop and the command line don't have options to change visibility — they only interact with the repository's code.

If I make my repository private, will people lose access to code they already downloaded?

No. If someone cloned or forked your repository when it was public, they have a copy on their own computer or account. Making your repository private doesn't delete their copy. It only prevents new people from viewing or cloning it from GitHub.

Can I make a repository public if it contains someone else's code?

That depends on the license. If the code you're using has a license that allows public sharing (like MIT or Apache 2.0), you can make it public as long as you include the original license file. If the code is proprietary or has no license, making it public could violate copyright. Check the original source's license before changing visibility.