🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 3 Min Lesezeit
0

How to Change a Public Repository to Private Using GitHub CLI

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

When working on personal, academic, or professional projects, we often start a repository as public to share progress, test configurations, or collaborate openly. However, at some point, it may become necessary to protect the code, especially if the project contains business logic, internal configurations, technical documentation, or an architecture that we do not want to expose yet.



In this article, we will see how to change a repository from public to private using GitHub CLI (gh), directly from the terminal.









Prerequisite



Before running the commands, you need to have GitHub CLI installed and configured.



You can check if gh is installed with:




CODE
gh --version






You can also verify if you are properly authenticated:




CODE
gh auth status






If you are not logged in, you can authenticate with:




CODE
gh auth login












Change a Public Repository to Private



The most direct way to change the visibility of a repository using GitHub CLI is:




CODE
gh repo edit OWNER/REPO --visibility private --accept-visibility-change-consequences






For example:




CODE
gh repo edit username/my-repository --visibility private --accept-visibility-change-consequences






The important flag here is:




CODE
--accept-visibility-change-consequences






GitHub requires this flag because changing the visibility of a repository can have consequences, such as affecting forks, stars, watchers, access permissions, or related integrations.









Change Visibility from the Local Repository Folder



If you are already inside the project folder and the local repository has its GitHub remote configured, you can run:




CODE
gh repo edit --visibility private --accept-visibility-change-consequences






Example:




CODE
cd my-repository
gh repo edit --visibility private --accept-visibility-change-consequences






If everything goes well, GitHub CLI will show a message like this:




CODE
✓ Edited repository username/my-repository






This means the repository was updated successfully.









Verify That the Repository Is Private



After changing the visibility, it is a good practice to verify the repository status.



To check a specific repository:




CODE
gh repo view username/my-repository --json visibility






The expected response should be:




CODE
{
"visibility": "PRIVATE"
}






You can also verify it from inside the local project folder:




CODE
gh repo view --json visibility






Expected result:




CODE
{
"visibility": "PRIVATE"
}






This confirms that the repository is no longer public.









Open the Repository in the Browser



You can also open the repository directly from the terminal using:




CODE
gh repo view username/my-repository --web






Or, if you are inside the local project folder:




CODE
gh repo view --web






This will open the repository on GitHub in your browser, where you can visually review the configuration.









What Happens to Collaborators?



When a repository becomes private, only the following users will have access:




  • The repository owner

  • Manually added collaborators

  • Organization members with the corresponding permissions, if applicable



You can review the collaborators with:




CODE
gh api repos/username/my-repository/collaborators












Useful Command Summary



Change a repository to private:




CODE
gh repo edit OWNER/REPO --visibility private --accept-visibility-change-consequences






Change a repository to private from the local folder:




CODE
gh repo edit --visibility private --accept-visibility-change-consequences






Verify repository visibility:




CODE
gh repo view OWNER/REPO --json visibility






Open the repository on GitHub:




CODE
gh repo view OWNER/REPO --web












Conclusion



GitHub CLI allows us to manage repositories quickly and efficiently from the terminal. Changing a repository from public to private is a simple but important task when we want to protect code, documentation, or project configurations.



This workflow is especially useful when working on projects that are still in development, contain sensitive information, or are not ready to expose publicly.



With a single command, we can update the repository visibility and then verify the change directly from the terminal.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Change a Public Repository to Private Using GitHub CLI

Thematisch verwandte Begriffe: Change, Public, Repository, Private · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...