Suresh Kamrushi
Practical guide · GitHub

How to Make a GitHub Repository Private—and What Changes

You can change a public repository’s visibility in its settings. Before you do, understand how the change can affect forks, stars, watchers, and any site published with GitHub Pages.

Making a repository private limits access to people you explicitly authorize. It is a useful way to protect source code or move a project out of public view, but it can also affect people and services that currently depend on the repository.

Before changing the visibility

Review the repository’s collaborators, integrations, and published content. In particular, check whether you use GitHub Pages or have shared the repository publicly. Changing a repository’s visibility does not automatically make separate copies or services private.

Pause before confirming: If maintaining public forks, stars, watchers, or a live Pages site matters, understand the impact and plan for it before you switch visibility.

Change an existing repository to private

  1. Sign in to GitHub and open the repository you want to change.
  2. Select Settings in the repository navigation. You need sufficient repository permissions to change its visibility.
  3. On the General settings page, scroll to Danger Zone.
  4. Find Change repository visibility, select Change visibility, and choose Make private.
  5. Read GitHub’s confirmation and impact messages. Complete the requested confirmation, such as typing the repository name or re-entering your password.
  6. After the change, review repository access and confirm the intended collaborators can still reach it.

Create a new private repository

If you are starting a new project, choose Private in the visibility options on GitHub’s New repository page before selecting Create repository. This avoids publishing the new repository as public in the first place.

Final checks

GitHub may update its interface and visibility behavior over time, and some controls depend on your permissions or plan. Read the current confirmation screen carefully before making the change.