By default, GitHub repositories can be either public or private. Public repositories are visible to everyone, while private repositories restrict access only to you and collaborators you explicitly invite. Making your repository private is a great way to protect sensitive code or work-in-progress projects.
This guide will show you how to make a GitHub repository private, whether you’re creating a new repo or updating an existing one.
✅ Method 1: Make an Existing Repository Private
Step 1: Go to Your Repository on GitHub
- Log in to GitHub and navigate to the repository you want to make private.
Step 2: Open Repository Settings
- Click the Settings tab near the top right of the repository page.
Step 3: Change Repository Visibility
- Scroll down to the Danger Zone section.
- Click Change repository visibility.
- Select Make private.
- Read the warnings, then confirm by typing the repository name.
- Click I understand, make this repository private.
✅ Method 2: Create a New Private Repository
Step 1: Click the New Repository Button
- From your GitHub homepage, click New to create a new repository.
Step 2: Set Repository Details
- Enter the repository name and description.
- Under Repository privacy, select Private.
Step 3: Complete Creation
- Choose other options (README, .gitignore, license) if desired.
- Click Create repository.
🧠 Important Notes
- Private repositories are only accessible to you and collaborators you invite.
- GitHub Free plans now allow unlimited private repositories with some collaborator limits.
- You can always add collaborators under the Settings > Manage access tab.
🧩 Summary
Task | Steps |
---|---|
Make existing repo private | Settings > Danger Zone > Change visibility > Make private |
Create new private repo | New repo > Set privacy to Private |
Add collaborators | Settings > Manage access |
📌 Final Thoughts
Making a repository private ensures your code is secure and accessible only to trusted contributors. Whether you’re protecting proprietary code or working on a private project, GitHub makes it easy to control access.