Skip to content
codelicenses Earn $500+ per repo

How do you make a GitHub repository private?

Open the repository, go to Settings, scroll to the Danger Zone, choose Change repository visibility, select Private, and confirm by typing the name. Private repositories are free on every GitHub plan. Making a public repository private stops new visitors seeing it. It does not recall the copies already taken.

Updated 23 September 2026


Flipping the switch is easy. Understanding what it changes is the part people skip, and it matters, because there are two different things the word “private” can mean and only one of them is a setting.

The steps

Open the repository. Settings. Stay on General, scroll to the Danger Zone at the bottom.

Click “Change repository visibility”. Choose Private. GitHub lists the consequences (more on those below) and asks you to type the repository name to confirm. Confirm.

To create a repository private from the start, choose Private on the new repository form. That is the better path, for reasons that take up the rest of this page.

Private repositories are free on every GitHub plan with unlimited collaborators. A few features are gated on the Free plan for private repositories, such as protected branches, but visibility is not one of them.

What changes

Nobody without access can see the repository, its code, issues, or history. It disappears from your public profile and from GitHub search.

Existing public forks are detached and continue as independent public repositories. Stars and watchers are cleared. A GitHub Pages site served from the repository is unpublished. Some integrations that depend on public visibility stop working.

Over time, search engine caches of the repository’s pages expire.

What does not change

Every clone made while the repository was public is a full copy, history included. Every fork is now an independent public repository. Packages built from the code remain on their registries. Web archives keep what they crawled.

And if it was public for any meaningful length of time, it has been collected into training corpora. Public code hosts were the first and largest source of code for training coding models, and the collection is continuous. Making the repository private today stops future collection of future commits. It does not withdraw anything already taken.

This is the point that matters most and the one the visibility setting cannot fix. What actually happens to your code, and which of your settings still make a difference, is worked through in is my private code used to train AI.

┌─ WORTH CHECKING ─────────────────────────────────────────────────────┐
│                                                                      │
│  Private, finished, owned by you: $500+ each to AI labs.             │
│                                                                      │
│  [ See what my repos are worth ]                                     │
│                                                                      │
└──────────────────────────────────────────────────────────────────────┘

Private from the start, or private now

These are different states and it is worth keeping them apart.

A repository that has been private since its first commit was never published. Nobody cloned it, nobody forked it, nothing collected it. Whatever value it has, it still has.

A repository that was public and is now private has been published. The setting changed; the history of the setting did not. Copies exist, and for any purpose that depends on scarcity, the scarcity is gone.

For most people the practical instruction is simple: decide visibility when you create the repository, not later. Default to private for client work, internal tools, products, and anything you might not want collected. Publish deliberately, understanding that publishing is a one-way door.

What “private” means for licensing value

There is a market for licensing source code to the labs that train coding models, and it pays for one thing above all: code that was never published. Public code has been collected already, and nobody pays for what they have.

So when that market says “private”, it means never public. A repository you made private last week after three years in the open is private in GitHub’s sense and public in the sense that counts.

That distinction decides which of your repositories are worth anything, and most developers have some in each category. The full definition, and what else has to be true, is in can you license private repositories. The reason public code has no licensing value left is the subject of your MIT-licensed repo is worth nothing.

Collaborators and access

Once private, access is granted per person or per team. On a personal account, Settings, Collaborators. In an organisation, Settings, Collaborators and teams. Read access lets someone clone; write access lets them push.

If the reason you are making a repository private is that you intend to license it, note that licensing programmes work from read-only access to the specific repositories you choose, granted through the provider’s app, and do not require you to add anyone as a collaborator.

Common questions

Are private repositories free on GitHub?
Yes, on every plan, with unlimited collaborators. Some features are limited on the Free plan for private repositories, such as protected branches and code owners, but visibility itself costs nothing.
What happens to forks when I make a repository private?
Existing public forks are detached and carry on as independent public repositories. Making your copy private does nothing to theirs. Stars and watchers are also cleared.
Does making a repository private remove it from search engines?
Over time, yes, as cached pages expire. It does not remove copies already cloned, forked, archived, or collected into training datasets.
Can I make a repository public again later?
Yes, from the same Change visibility control. Stars and forks do not come back. And the moment it is public again, it is collectable again.
Is a repository that used to be public counted as private for licensing?
No. For licensing purposes private means never published. Code that was public at any point has already been collected and holds no scarcity, whatever its visibility setting says today.

WORTH CHECKING

Earn $500+ on every repo you never open.

Private, finished, owned by you: $500+ each to AI labs.

Non-exclusive, so you keep the code and are paid again on every re-license.

See what my repos are worth