Public and Private Repositories
Asha's recipe-box is public, so anyone can read it. Her cousin wants to start a repository for a family cookbook that includes grandma's secret recipes and relatives' phone numbers. The choice between public and private decides who can see a repository and everything in its history.
The rule
Public means anyone can see all of it, including history; private means only people you invite.
Public repositories:
- Anyone on the internet can view the files, the full commit history, issues and pull requests.
- Anyone can clone or fork it. Only people you give access can push.
- They suit open-source projects, portfolios, learning projects and documentation.
Private repositories:
- Only you, people you add as collaborators, and members of an organisation who have been given access can see them.
- They suit unfinished work, personal notes, coursework you should not share, and anything containing information that must not be public.
- Free accounts can have private repositories and invite collaborators to them.
You can change visibility later in the repository's Settings, under the section for dangerous actions. Think before you do it:
- Private → public exposes the entire history. A password that was committed and then "deleted" three months ago becomes readable by everyone, because it is still in an old commit.
- Public → private hides the repository from now on, but it cannot recall copies. Anyone who already cloned or forked it keeps their copy.
One more point that surprises people: public is not the same as open source. Without a licence file, others may view and fork your code on GitHub, but they have no clear legal permission to reuse it elsewhere. If you want people to reuse your work, add a licence.