Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neal-c/ghpm

Turn all your repositories private with 1 CLI command (but not the starred ones)
https://github.com/neal-c/ghpm

cli github-api go golang oauth2

Last synced: 29 days ago
JSON representation

Turn all your repositories private with 1 CLI command (but not the starred ones)

Awesome Lists containing this project

README

        

# A tool to manage privacy on github

> [!WARNING]
> Turning a starred repository into a private repository will lose all the stars
> Current forks will remain public and will be detached from the repository.

> [!IMPORTANT]
> if it has >= 1 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

> [!NOTE]
> Also exists as github cli extension : https://github.com/Neal-C/gh-ghpm

## Requirements

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

## Installation

with go ( golang)

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

One liner install command (Linux/amd64 & Linux/x86_64) :

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

Manual install

For Linux/amd64 and Linux/x86_64
```bash
# requires: curl
# ~
curl -L -o ghpm https://github.com/Neal-C/ghpm/releases/latest/download/ghpm-linux-amd64
```

give ghpm executable permissions
```bash
# ~
chmod +x ghpm
```

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

Uninstall :
```bash
# ~
# might require to be prefixed with sudo: sudo rm /usr/local/bin/ghpm
rm /usr/local/bin/ghpm
```

## Usage

```bash
# prints help message
ghpm --help
```

```bash
# 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

- [x] list your private repos

- [x] list your public repos

- [x] switch every repositories to private (excluding repos with >= 1 stars)

- [x] switch 1 repository to private

- [x] switch 1 repository to public

- [x] shell installation script

if time and will :

- [ ] persist auth to allow multiple successive commands

## 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
- 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.