A powerful Bash script to manage your GitHub followers and following. Easily identify users who don't follow you back, bulk unfollow non-followers, and follow back your followers - all with dry-run support and rate limiting.
- View Non-Followers: See who you follow that doesn't follow you back
- View Unfollowed: See followers you haven't followed back
- Bulk Unfollow: Remove all non-followers at once
- Selective Unfollow: Review and choose each user individually
- Bulk Follow Back: Follow all your followers with one command
- Dry Run Mode: Preview actions before executing them
- Rate Limiting: Built-in delays to avoid GitHub API throttling
- Progress Tracking: Real-time progress indicators
- Token Persistence: Save your token securely for future sessions
- Logging: All actions logged with timestamps
- Cross-Platform: Works on Windows (Git Bash), macOS, and Linux
- Auto-Install Dependencies: Automatic jq installation on Windows via Scoop
| Dependency | Purpose | Installation |
|---|---|---|
| Bash | Shell interpreter | Pre-installed on macOS/Linux, use Git Bash on Windows |
| curl | API requests | Pre-installed on most systems |
| jq | JSON parsing | See installation below |
Windows (Git Bash):
# The script will offer to install automatically via Scoop
# Or manually:
scoop install jqmacOS:
brew install jqLinux (Debian/Ubuntu):
sudo apt install jqLinux (Fedora/RHEL):
sudo dnf install jq-
Clone the repository:
git clone https://github.com/lancedesk/github-unfollower.git cd github-unfollower -
Make the script executable:
chmod +x gh-followers.sh
-
Create a GitHub Personal Access Token:
- Go to GitHub Settings β Tokens
- Click "Generate new token (classic)"
- Select the
user:followscope - Copy the generated token
-
Run the script:
./gh-followers.sh
-
(Optional) Install globally:
chmod +x install.sh ./install.sh
Then restart your terminal and just type:
followers
The install.sh script adds the followers command to your system PATH, allowing you to run it from any directory.
chmod +x install.sh
./install.shAfter installation, restart your terminal (or run source ~/.bashrc) and use:
followers| Operating System | Installation Location | Method |
|---|---|---|
| Windows (Git Bash) | ~/bin/followers |
Wrapper script + adds to ~/.bashrc |
| macOS | /usr/local/bin/followers or ~/bin |
Symlink |
| Linux | /usr/local/bin/followers or ~/.local/bin |
Symlink + adds to ~/.bashrc |
To remove the followers command from your PATH:
chmod +x uninstall.sh
./uninstall.shThis removes the command but keeps your token and logs intact.
github-unfollower/
βββ gh-followers.sh # Main script (don't move/delete!)
βββ install.sh # Installer
βββ uninstall.sh # Uninstaller
βββ .github-token # Your saved token (gitignored)
βββ .gitignore # Ignores sensitive files
βββ gh-follower-manager.log # Action log
βββ README.md # This file
Note: Don't move or delete the
gh-followers.shscript after installation - thefollowerscommand points to it!
Option 1 - Direct:
./gh-followers.shOption 2 - Global command (after installation):
followersOn first run, you'll be prompted to enter your GitHub token. The token is saved securely to .github-token for future sessions.
=========================================
GitHub Follower Manager
=========================================
1) Show who you follow but they don't follow back
2) Show your followers you don't follow back
3) Unfollow users who don't follow you back (bulk)
4) Unfollow users (selective - choose each)
5) Follow back your followers (bulk)
6) Show rate limit status
7) Change GitHub token
8) Debug: Show counts
9) Exit
=========================================
| Option | Description |
|---|---|
| 1 | Lists users you follow who don't follow you back (potential bots/spam accounts) |
| 2 | Lists your followers that you haven't followed back yet |
| 3 | Bulk unfollow all non-followers (with dry-run option) |
| 4 | Review each non-follower individually and choose to unfollow or keep |
| 5 | Bulk follow all your followers you're not currently following |
| 6 | Check your GitHub API rate limit status |
| 7 | Update or change your GitHub token |
| 8 | Debug mode showing raw counts and mutual follow statistics |
| 9 | Exit the program |
When performing bulk actions (options 3 and 5), you'll be asked:
Dry run first? (y/n):
- y: Preview what would happen without making changes
- n: Execute actions immediately
After a dry run, you can choose to execute for real:
Execute for real? (y/n):
| Variable | Default | Description |
|---|---|---|
GITHUB_TOKEN |
- | Your GitHub Personal Access Token |
WAIT_BETWEEN_REQUESTS |
2 | Seconds between API calls |
WAIT_BETWEEN_ACTIONS |
5 | Seconds between follow/unfollow actions |
| File | Description |
|---|---|
.github-token |
Stores your GitHub token (gitignored) |
gh-follower-manager.log |
Action log with timestamps |
- Your token is stored locally in
.github-tokenwith restricted permissions (chmod 600) - The token file is included in
.gitignoreto prevent accidental commits - Never share your GitHub token or commit it to version control
Script exits unexpectedly during dry run:
- Fixed in latest version. Was caused by bash arithmetic with
set -e
Same users appearing in both "don't follow back" lists:
- Fixed in latest version. Was caused by Windows line endings (
\r)
"jq: command not found":
- Install jq using the commands in the Requirements section
- On Windows, the script offers automatic installation via Scoop
"Authentication failed":
- Ensure your token has the
user:followscope - Generate a new token if the old one expired
- Use option 7 to update your token
Rate limit exceeded:
- Use option 6 to check your rate limit status
- Wait for the rate limit to reset (shown in the output)
- The script includes built-in delays to avoid this
- Use Git Bash to run the script (comes with Git for Windows)
- The script automatically detects Windows and handles line endings
- If Scoop/jq installation fails, restart your terminal after installation
- The script should work out of the box
- Ensure
bash,curl, andjqare installed - Make the script executable with
chmod +x gh-followers.sh
GitHub API has rate limits:
- Authenticated requests: 5,000 per hour
- The script shows remaining requests after authentication
- Built-in delays prevent hitting rate limits during normal use
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub API documentation
- The jq project for JSON parsing
- Scoop package manager for Windows
If you encounter any issues or have questions:
- Check the Troubleshooting section above
- Open an issue on GitHub
- Include your OS, bash version, and error messages