🛠️ How I Made My Old Public GitHub Repos Private (All at Once)
How to Make Multiple GitHub Repos Private at Once – Simple CLI Guide

Search for a command to run...
How to Make Multiple GitHub Repos Private at Once – Simple CLI Guide

No comments yet. Be the first to comment.
Large language models can answer questions, write content, summarize information, and help with many other tasks. However, they have one important limitation: they do not automatically know everything

Uploading images directly from an Expo app to Amazon S3 can make your uploads faster and reduce work on your backend server. However, you should never put AWS access keys inside your Expo app. Anyone

Today, you do not need to pay for an AI API just to test AI models. You can run many open-source or open-weight AI models directly on your own laptop or PC. This means the model runs on your machine,

Deploying for Indian user data safety

Why I spent 3 years manually excluding IDE files from every single repo (and how one config line fixed everything)

So recently, I was cleaning up my GitHub profile — and I realised I had so many random public repos 😅
Some were test projects, some half-done college stuff, and a few experiments I never even finished.
I didn’t want people to see all that junk, but GitHub doesn’t let us make multiple repos private at once using the normal UI.
So I found a simple solution using GitHub CLI. Here’s what I did 👇
I installed GitHub CLI using this command in CMD:
winget install GitHub.cli
If you’re using Linux or Mac, you can check the install guide here: https://cli.github.com/manual/installation
After installation, I logged in using:
gh auth login
It asked some questions:
I selected GitHub.com
Then chose HTTPS
Then opened browser and signed in — done.
Now I made a list of repos I wanted to make private.
Just the repo names — not the full URL.
For example:
repos=(
test-app
mini-project
random-api
)
I created a file called make-private.sh and added this code:
#!/bin/bash
repos=(
repo1
repo2
repo3
)
username="your_github_username"
for repo in "${repos[@]}"
do
echo "Making $repo private..."
gh repo edit "$username/$repo" --visibility private --accept-visibility-change-consequences
done
Replace:
repo1, repo2, etc. with your actual repo names
your_github_username with your real GitHub username
Since I’m on Windows, I opened Git Bash (comes with Git) and ran:
chmod +x make-private.sh
./make-private.sh
That’s it! All my selected repos became private. 🫡
If you want to list your current public repos, you can run:
gh repo list yourusername --visibility public
Copy the names from here and paste them into your script.
This small trick helped me clean up my profile fast. Now only my good projects are public — the rest are hidden from the world 😎
If you're a developer or student like me who has experimented a lot on GitHub, give this method a try. Simple and effective.
Let me know if it worked for you too!
If you found this blog helpful, share it with your dev friends or star my projects on GitHub 💖
🌐 Portfolio: amanraj.me
🐙 GitHub: [github.com/huamanraj]
💼 LinkedIn: [linkedin.com/in/huamanraj]
🐦 Twitter/X: [x.com/huamanraj]
Thanks for reading! 🙌