GHRapt
Rapture your files in to the github cloud ☁️✨
Because your files deserve a one-way trip to Microsoft's finest servers
📦 Installation
pip install ghrapt
☕ Support
If you find this project helpful, consider supporting me:
🚀 Quick Start
# Set your GitHub token
export GH_TOKEN=your_github_token
# Push files to a repository
ghrapt --repo username/repo-name ./path/to/files
# Or with a commit message
ghrapt --repo username/repo-name --message "My backup" ./docs
🎯 Why GHRapt?
- One-way backup to the cloud - perfect for backups
- No Git commands needed - just push your files
- No
.gitfolder - keeps your working directory clean - Minimal disk writes - no local Git database to maintain
- Directory overlay support - merge multiple directories
⚠️ Limitations
- GitHub API rate limits apply
- Optimized for small files
- Not a replacement for full Git version control
Features
- 📁 Tree-based file management - Work with files and directories as a hierarchical tree structure
- ☁️ GitHub as storage backend - Store files using GitHub's Git Data API
- 🔄 Push & Pull - Upload local files to GitHub or download existing trees
- 📝 Commit support - Create commits with custom messages and parent references
- 🚫 Gitignore integration - Respect
.gitignorepatterns during upload - 🔗 Symbolic link handling - Configurable strategies for symlinks (keep/follow/safe)
- 📊 File filtering - Filter by size, ignore patterns, and more
Installation
pip install ghrapt
Configuration
GHRapt requires GitHub authentication. Set the following environment variables:
export GH_REPO="owner/repository-name"
export GH_TOKEN="your_github_token"
export GH_USER="your_username" # optional
export GH_EMAIL="your_email@example.com" # optional
Or use a config file at ~/.config/ghrapt.conf or ~/ghrapt.conf:
[owner/repo]
token = your_github_token
email = your_email@example.com
Usage
Command Line Interface
# Upload files to GitHub
ghrapt --repo owner/repo --act /path/to/files
# Upload with commit message
ghrapt -R owner/repo -a -m "Initial commit" ./docs
# Dry run (default)
ghrapt -R owner/repo ./src
# Upload with size filter
ghrapt -R owner/repo --maxsize 1048576 ./files
# Control symlink behavior
ghrapt -R owner/repo --links safe --dir-links follow ./data
Python API
from ghrapt import GHRapt
# Initialize client
api = GHRapt()
api.set_repo("owner/repo")
api.use_logging()
# Place local files into the tree
api.place("./myfiles", root="project")
# Push to GitHub
api.push(dry_run=False)
# Commit changes
api.commit(message="Added my files", dry_run=False)
# Pull existing content
api.pull(ref="master")
api.ls() # List contents
File Operations
# Remove files
api.rm("file.txt", "old_dir/")
# Rename/move
api.ren("old_name.txt", "new_name.txt")
# List tree contents
api.ls()
# Place files at specific root
api.place("./assets", root="static/images")
How It Works
GHRapt builds an in-memory tree structure representing your files, then pushes them to GitHub using the Git Data API:
- Walk - Scan local directories and build a
GHNodetree - Push - Upload blobs, trees, and symlinks to GitHub
- Commit - Create a commit referencing the root tree SHA
- Update ref - Update the branch reference to point to the new commit
Tree Structure
GHNode- Tree node containing name and dataGHDirData- Directory node with childrenBlobData- File content (supports streaming for large files)SymlData- Symbolic linkGHObject- Remote GitHub object for pulling
Commands Reference
| Command | Description |
|---|---|
pull(ref) |
Download tree from GitHub |
push() |
Upload local tree to GitHub |
place(paths) |
Add local files to tree |
commit(message) |
Create commit from current tree |
ls() |
List tree contents |
rm(paths) |
Remove files from tree |
ren(old, new) |
Rename/move files |
Advanced Options
Push Options
stream=True- Stream large files instead of loading into memorypause_sec=N- Add delay between uploads (rate limiting)dry_run=False- Actually push (default is dry run)
Place Options
follow_links="keep/follow/safe"- How to handle file symlinksfollow_dir_links="keep/follow/safe"- How to handle directory symlinksgitignore_ancestors=True- Respect parent.gitignorefilesmaxsize=N- Skip files larger than N bytesoverwrite=True- Overwrite existing files
Commit Options
parent_commit_sha- Specify parent commitref_path- Branch reference (e.g.,refs/heads/main)create_ref- Create new branch if it doesn't exist
Status
Alpha - Under active development. APIs may change.
Dependencies
requests- HTTP client for GitHub APIPyYAML- YAML output formatting
Release files for ghrapt 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ghrapt-0.0.2.tar.gz | 62.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ghrapt-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.3 kB
Release files / ghrapt-0.0.2.tar.gz
| Download URL | ghrapt-0.0.2.tar.gz |
|---|---|
| Size | 62.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cc7183762a24abcd0882dcd04d9a166620596a74c8320ff863564e092675f4d
|
|
BLAKE2b-256 checksum How to use checksums |
0728ba76a588a9bb566a8489c875851d95fba3f06fa95fead57cee7478e2b8b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / ghrapt-0.0.2-py3-none-any.whl
| Download URL | ghrapt-0.0.2-py3-none-any.whl |
|---|---|
| Size | 52.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ce318649b5b8037028fcf73c5888d69fcb0948f7fbba15f19891fb3534f95ee
|
|
BLAKE2b-256 checksum How to use checksums |
6c0c4298cd3c17b0b2b529b76d7cfa352d1a6923dae9054e5368942a683045c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|