Skip to content
/ ghpm Public

Turn all your repositories private with 1 CLI command

License

Notifications You must be signed in to change notification settings

Neal-C/ghpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A tool to manage privacy on github

Warning

Turning a starred repository into a private repository will lose all the stars

Important

if it has >= 4 stars, ghpm does not turn a starred repository into a private repository.
It does not turn your README repository (username/username) private because it's a special repository meant for public display

Note

I am not sponsored by github, nor affiliated, but you can change that by pinging them on social media

Requirements

  • Go >= 1.23 for go install and contributing
  • unix-like system for user installation

Installation

with go ( golang)

go install github.com/Neal-C/ghpm@latest

For Linux

# requires: curl unzip
# ~
curl -L -o \ 
ghpm \
"https://github.com/Neal-C/ghpm/releases/download/v0.1.0-rc/ghpm-linux-amd64"

give ghpm executable permissions

# ~
chmod +x ghpm

move to /usr/local/bin

# ~
# might require to be prefixed with sudo: sudo mv ghpm usr/local/bin/ghpm
mv ghpm usr/local/bin/ghpm

One liner install command :

curl -s "https://raw.githubusercontent.com/Neal-C/ghpm/main/docs/install.sh" | bash

Uninstall :

rm -rf usr/local/bin/ghpm

Usage

ghpm --help
# turns all your repositories private 
ghpm thanos_snap

Roadmap

  • lobby github for ghpm features to included in gh CLI so that I don't have to maintain this repository for free forever

  • lobby github for a batch request endpoint, so that it can be only 1 HTTP call and not O(n) HTTP calls

  • list your private repos

  • list your public repos

  • switch every repositories to private (excluding repos with >= 4 stars)

  • switch 1 repository to private

  • switch 1 repository to public

  • shell installation script

if time and will :

  • persist auth to allow multiple successive commands

  • have other exclude/include flags than stars

Contributing

I am open to random pull requests that do at least 1 of the following :

  • cross items off the roadmap
  • fix typos
  • add tooling
  • add tests
  • add/improve documentation
  • add examples
  • improve CI/CD

How to permanently delete or hide data from a repository ?

Only sure way is to contact github support : https://support.github.com/

When in doubt, revoke and rotate your keys. Or better yet, automate it.

Why didn't you just ... ?

  • use the official sdk :

    • Because it's a codegen sdk and not human maintained. The code has been generated by Microsoft's kiota codegen framework with OpenAPI specs and the codebase is just unreadable. it also would require me to use kiota-abstractions in my code, you're free to go check out what they are but have a bucket nearby before you do that.
    • also it's not stable yet and breaking changes may happen at any time (says their README)
  • use github.com/google/go-github/v66 :

    • realized too late, that I could've. It was a legit option.
    • I was never going to use all of their features, so that's 1 dependency avoided.
    • it would have been a missed opportunity to learn device authentication, Oauth flow and the inners of github.