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.
- Forks: GitHub warns that public forks are detached from the public repository network and become separate repositories.
- Stars and watchers: GitHub removes existing stars and watchers when a public repository is made private. Treat this as permanent.
- GitHub Pages: A Pages site may be unpublished when repository visibility changes. Check the current Pages and plan settings first, and make another hosting plan if the site needs to stay online.
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
- Sign in to GitHub and open the repository you want to change.
- Select Settings in the repository navigation. You need sufficient repository permissions to change its visibility.
- On the General settings page, scroll to Danger Zone.
- Find Change repository visibility, select Change visibility, and choose Make private.
- Read GitHub’s confirmation and impact messages. Complete the requested confirmation, such as typing the repository name or re-entering your password.
- 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
- Confirm the repository shows as private and review who has access.
- Check GitHub Pages, automation, and integrations that may rely on the repository’s previous visibility.
- If you need a public website, verify its deployment and hosting separately; repository privacy and website visibility are not the same setting.
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.