Learn how to make your GitHub repository private with easy step-by-step instructions. Use the web interface or GitHub CLI to secure your code.
Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Logging into your GitHub account
Before you can change any repository settings, you need to be signed in.
Step 2: Navigating to your repositories
Once signed in, you’ll need to locate the repository you want to modify.
Step 3: Selecting the repository to make private
Choose the exact repository whose visibility you wish to change.
Step 4: Opening the repository settings
The repository settings menu contains the visibility controls.
Step 5: Scrolling down to the visibility controls
The visibility options are located in the “Danger Zone.”
Step 6: Changing the repository to private
You can now initiate the change from public to private.
username/repository-name
).
Step 7: Verifying the repository is now private
After confirmation, you should see that the repository is private.
Step 8: (Optional) Using GitHub CLI to make a repository private
If you prefer the command line and have GitHub CLI installed, you can change visibility without using the web UI.
gh auth login
).
gh repo edit OWNER/REPO --visibility private
OWNER/REPO
with your username or organization and repository name (for example octocat/hello-world
).
Step 9: Confirming visibility change via GitHub CLI
You can double-check the new visibility status directly from the CLI.
gh repo view OWNER/REPO --json visibility
"visibility": "PRIVATE"
, the repository is now private.When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.