This script allows you to change the visibility of your GitHub repositories (public to private or private to public) in bulk.
- Clone the repository:
git clone https://github.com/sshd911/visibility-changer.git
cd visibility-changer
-
Configure your settings:
- Open
config.sh
and fill in the necessary variables. - The default configuration is to make all public repositories private.
- Open
-
Set your GitHub token and username an environment variables:
export GITHUB_TOKEN="your_github_token" export GITHUB_USERNAME="your_github_username"
Edit config.sh
to set your GitHub username and token. There are also options to set the visibility type and desired state (public/private).
#!/bin/bash
# Fill in your GitHub username and token. It is recommended to set these as environment variables for security reasons.
GITHUB_USER="${GITHUB_USERNAME}"
GITHUB_TOKEN="${GITHUB_TOKEN}"
# Specify the visibility type of the repositories to be processed.
# Options:
# "public" - Targets public repositories.
# "private" - Targets private repositories.
REPOS_VISIBILITY_TYPE="private"
# Specify the desired visibility change for the target repositories.
# Options:
# "true" - Set repositories to private.
# "false" - Set repositories to public.
SET_TO_PRIVATE="false"
- Make the script executable
chmod +x main.sh
chmod +x scripts/api_calls.sh
chmod +x scripts/repos_handler.sh
- Run the script
./main.sh
This will start the process of changing the visibility of your repositories based on the configuration in config.sh.
- Ensure your GitHub token has the necessary permissions to read and modify repository settings.
- If you encounter issues, check the output logs for error messages and open an issue.
If you find any bugs or have feature requests, feel free to open an issue or submit a pull request. Contributions are welcome!