Sync GitHub issues, discussions, and comments to local JSON files stored in your repository.
Gitman is a simple command-line tool that keeps your GitHub events synchronized as plain JSON files in a .gitman directory at your repository root. Perfect for:
- Offline access to issues and discussions
- Building custom search and analytics tools
- Creating backups of your GitHub data
- Integrating GitHub data with other tools
- Simple file-based storage - Issues and discussions stored as individual JSON files
- Incremental syncing - Only fetches updates since last sync (configurable)
- Full GitHub API support - Uses REST API for issues, GraphQL for discussions
- Rich CLI - Beautiful terminal output with progress indicators
- No dependencies on external services - Just you, GitHub, and local files
# Clone and install locally
git clone https://github.com/Bullish-Design/gitman.git
cd gitman
pip install -e .export GITHUB_TOKEN=ghp_... # Your GitHub Personal Access Token
export GITHUB_REPO=owner/repo # Repository to syncYour token needs the following scopes:
repo- For accessing private repositories and issuesread:discussion- For reading discussions
gitman initThis creates the following structure:
.gitman/
├── issues/ # One JSON file per issue
├── issue_comments/ # Comments organized by issue number
├── discussions/ # One JSON file per discussion
├── discussion_comments/ # Comments organized by discussion number
└── sync_state.json # Tracks last sync timestamps
# Sync everything (incremental)
gitman sync
# Full sync (fetch all data)
gitman sync --full
# Sync only issues
gitman sync --issues-only
# Sync only discussions
gitman sync --discussions-only
# Sync specific issue
gitman sync --issue 123
# Sync specific discussion
gitman sync --discussion 456gitman status# Initialize in a specific directory
gitman -d /path/to/repo init
# Sync a different repository
gitman -r owner/other-repo sync
# Use token from different env var or pass directly
export GITHUB_TOKEN=ghp_another_token
gitman syncEach issue is stored as .gitman/issues/{number}.json with the full GitHub API response, including:
- Title, body, state, labels
- Author, assignees, milestone
- Creation and update timestamps
- Reactions, comments count
Comments are stored as .gitman/issue_comments/{issue_number}/{comment_id}.json
Each discussion is stored as .gitman/discussions/{number}.json with:
- Title, body, category
- Author, labels, upvotes
- Answer status
- Creation and update timestamps
Comments are stored as .gitman/discussion_comments/{discussion_number}/{comment_id}.json
You can also use Gitman as a Python library:
from gitman import GitHubClient, FileStore, SyncManager
# Initialize components
client = GitHubClient(token="ghp_...")
store = FileStore()
sync_manager = SyncManager(client, store, "owner", "repo")
# Sync everything
sync_manager.sync_all()
# Load an issue
issue = store.load_issue(123)
# Get statistics
stats = store.get_stats()
print(f"Total issues: {stats['issues']}")# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/MIT License - see LICENSE file for details