Yes, you can make GitHub projects private. You'll find this option when creating a new repository or by changing the visibility settings of an existing one. For individual accounts, private repositories are free with unlimited collaborators. Organizational accounts might have different pricing tiers, but most offer free private projects for small teams. This helps protect sensitive code or ongoing personal projects.
GitHub allows you to control who can view and contribute to your code repositories. Making a project private means only you and specific collaborators you invite can access it. This is a standard practice for proprietary software, personal experiments, or work-in-progress code you don't want public yet.
Setting Repository Visibility
When you create a new repository on GitHub, you'll see an option to choose its visibility: public or private. Public repositories are visible to everyone on the internet, even those without a GitHub account. Private repositories are restricted. You control access.
You can change a repository's visibility anytime. Go to your repository's settings page. Scroll down to the "Danger Zone" section. Here, you'll find the "Change repository visibility" option. It's a quick process, usually taking less than 30 seconds. Be careful when switching from private to public, as all your code and history will become visible instantly. Over 80% of new personal projects start as private.
Collaborators and Access Control
With private repositories, you'll need to invite collaborators explicitly. You can add individuals by their GitHub username or email address. Each collaborator can be assigned different roles, such as "Read," "Triage," "Write," "Maintain," or "Admin." A "Write" role allows them to push changes, while "Read" only permits viewing.
For example, a small team of three developers might all have "Write" access. If you're working with an external contractor for a short period, you might grant them "Write" access for 30 days, then revoke it. You can manage these permissions under the "Settings" tab, then "Collaborators and teams." This control ensures only authorized people see your project files. It's a key security feature for any sensitive project, like a smart home setup's code base.
Cost of Private Repositories
For individual users, private repositories are free. This policy changed in 2019, removing previous restrictions on the number of private repositories or collaborators. You can have unlimited private repositories with unlimited collaborators without paying anything.
Organizations, however, might have different pricing structures. GitHub offers various plans for teams and enterprises. The Free plan for organizations still allows unlimited private repositories, but it limits the number of required collaborators to 3. If your organization needs more than three users with "Write" access or higher permissions, you'll likely need to upgrade to a Team plan, which starts at $4 per user per month. A typical Team plan with 10 users would cost $40 monthly. This cost is still significantly lower than older enterprise solutions.
Best Practices for Private Projects
Even with private repositories, it's wise to follow some security best practices. Don't commit sensitive information directly into your code, like API keys or passwords. Use environment variables or secure configuration management instead. Regularly review your collaborator list. Remove anyone who no longer needs access to the project.
For larger projects, consider using GitHub's "Issues" and "Pull Requests" features to track changes and feedback within your private environment. This helps maintain code quality and organization. You might also explore advanced security lighting techniques for your physical infrastructure if your project involves hardware.
Sources
- GitHub Pricing Plans. (n.d.). Retrieved from https://github.com/pricing
- GitHub Docs: Managing a repository's visibility. (n.d.). Retrieved from https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-a-repositorys-visibility
FAQ
Can I change a public repository to private?
Yes, you can. Go to your repository's "Settings," find the "Danger Zone," and select "Change repository visibility." It's a straightforward process.
Is there a limit to how many private repositories I can have?
No, individual GitHub accounts can have an unlimited number of private repositories. Organizations on a Free plan also get unlimited private repositories, but with a limit of 3 collaborators.
Do collaborators need a paid GitHub account to access my private repository?
No. Collaborators can access your private repository with a free GitHub account, provided you've invited them. Only certain organizational plans require paid seats for additional users.
What's the difference between private and public repositories?
Public repositories are visible to anyone, even without a GitHub account. Private repositories are only visible to you and the specific collaborators you invite. This protects your code.

