Skip to content

ariejan/gitmop

Repository files navigation

GitMop

A TUI (Terminal User Interface) tool for managing GitHub repositories with bulk operations like archiving, deleting, and downloading repositories.

Features

  • Browse repositories across organizations and personal accounts
  • Filter repositories by name
  • Mark repositories for archiving or deletion
  • Dry-run mode for safe testing (enabled by default)
  • Secure GitHub authentication via Device Flow
  • Download repositories as zip archives (coming soon)

Quick Start

1. Build the Project

git clone <repository-url>
cd gitmop
cargo build --release

2. Set Up GitHub Authentication

GitMop requires a GitHub OAuth App to authenticate. This is a one-time setup:

  1. Create a GitHub OAuth App:

    • Go to: https://github.com/settings/applications/new
    • Fill in the form:
      • Application name: GitMop (or any name you prefer)
      • Homepage URL: https://github.com/yourusername/gitmop (or any URL)
      • Authorization callback URL: http://localhost (required but not used)
    • Click "Register application"
  2. Get your Client ID:

    • After creating the app, you'll see a Client ID on the app page
    • Copy this Client ID (it looks like: Ov23liABCDEF1234567)
  3. Set the Environment Variable:

    export GITHUB_CLIENT_ID=your_client_id_here

    To make this permanent, add it to your shell profile:

    echo 'export GITHUB_CLIENT_ID=your_client_id_here' >> ~/.bashrc
    # or for zsh users:
    echo 'export GITHUB_CLIENT_ID=your_client_id_here' >> ~/.zshrc

3. Run GitMop

./target/release/gitmop

On first run, GitMop will:

  1. Open your browser to GitHub
  2. Show you a device code to enter
  3. Ask you to authorize the GitMop app
  4. Save your authentication token securely

Usage

# Run in dry-run mode (safe, default)
gitmop

# Run in execute mode (will perform actual operations)
gitmop --execute

Keybindings

  • Navigation: hjkl or arrow keys
  • Actions: space to cycle repository actions (None → Archive → Delete)
  • Filter: / to search repositories by name
  • Execute:
    • A - Confirm archive operations
    • D - Confirm delete operations (requires typing "Yes, I am sure")
    • E - Toggle between dry-run and live mode
  • Other: r refresh, q quit

Safety Features

  • Dry-run by default: All operations are simulated unless explicitly executed
  • Delete confirmation: Requires typing "Yes, I am sure" exactly
  • Archive confirmation: Simple yes/no confirmation
  • Admin-only repositories: Only lists repos where you have admin permissions

Troubleshooting

"GITHUB_CLIENT_ID environment variable not set"

This means you haven't completed the authentication setup. Follow the steps in section 2 above.

"Failed to request device code: 404 Not Found"

Your GITHUB_CLIENT_ID is invalid. Make sure you:

  1. Created the GitHub OAuth App correctly
  2. Copied the correct Client ID
  3. Set the environment variable properly

You can verify your environment variable is set with:

echo $GITHUB_CLIENT_ID

Authentication Issues

If you're having trouble authenticating:

  1. Clear stored tokens: rm ~/.config/gitmop/auth.json
  2. Try again: gitmop
  3. Make sure you're logged into GitHub in your browser

Configuration

GitMop stores configuration in ~/.config/gitmop/:

  • config.json - User preferences and last selected organization
  • auth.json - Encrypted authentication token (600 permissions)

Development

# Build and run
cargo run

# Run tests
cargo test

# Format and lint
cargo fmt --all && cargo clippy --all-targets -- -D warnings

License

MIT

About

GitMop helps you clean-up your git repositories

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published