Sync all your local projects to GitHub automatically
Project description
GitHub Sync Agent
Automatically syncs every local project directory to its own GitHub repository.
For each project it will:
git initif not already a repo- Create the GitHub repo if it doesn't exist yet
- Ensure the remote uses SSH
- Stage + commit any uncommitted changes
- Push to
origin
Runs daily via a systemd user timer, and on-demand via CLI.
Installation
pip install github-sync-agent
First-time setup
github-sync init
The wizard will:
- Check
gitandghare installed - Authenticate with GitHub (
gh auth login) - Ask which folder to scan for projects
- Set up your SSH key automatically
- Verify SSH works (auto-fixes port 443 and ssh-agent if needed)
- Write a config file to
~/.config/github-sync/config.yaml
Setup will not complete until ssh -T git@github.com succeeds.
Usage
# Sync all projects
github-sync sync
# Sync a single project
github-sync sync --project my-project
# Preview without making changes
github-sync sync --dry-run
# Show status of all projects
github-sync status
HTTP API
Install API dependencies:
pip install 'github-sync-agent[api]'
Start the server:
github-sync serve
# → http://127.0.0.1:8741
Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check (no auth) |
GET |
/status |
Sync status for all projects |
POST |
/sync |
Sync all projects |
POST |
/sync/{project} |
Sync one project |
Optional body for POST: {"dry_run": false}
Examples
curl http://127.0.0.1:8741/health
curl http://127.0.0.1:8741/status
curl -X POST http://127.0.0.1:8741/sync
curl -X POST http://127.0.0.1:8741/sync/Agents
API authentication (optional)
Add to config.yaml:
api_key: "your-secret-key"
Then pass the key on every request (except /health):
curl -H "Authorization: Bearer your-secret-key" http://127.0.0.1:8741/status
Run as a systemd service
cp systemd/github-sync-api.service ~/.config/systemd/user/
systemctl --user enable --now github-sync-api.service
Configuration (~/.config/github-sync/config.yaml)
Generated by github-sync init. You can edit it at any time.
| Key | Default | Description |
|---|---|---|
github_user |
(detected from gh auth) | Your GitHub username |
projects_root |
~/projects |
Scans all subdirectories here |
schedule_time |
02:00 |
Daily run time |
default_visibility |
private |
private or public for new repos |
auto_commit_message |
chore: auto-sync |
Commit message for auto-commits |
exclude |
[] |
Directory names to skip |
log_file |
~/.local/share/github-sync/github-sync.log |
Log file path |
log_level |
INFO |
DEBUG / INFO / WARNING / ERROR |
api_host |
127.0.0.1 |
API bind address |
api_port |
8741 |
API port |
api_key |
(empty) | Optional Bearer token for API auth |
Excluding a project
exclude:
- SomeProjectToSkip
Requirements
- Python 3.10+
gitinstalledgh(GitHub CLI) installed — installation guide
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_sync_agent-0.2.0.tar.gz.
File metadata
- Download URL: github_sync_agent-0.2.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ffbebcfadb1046172a84bbc1d694a775e6d215d554a99747811b8d2db4e4747
|
|
| MD5 |
8249c38d444aa07456c9ea97f01134e4
|
|
| BLAKE2b-256 |
570b0ac4dc32c032825254c9ad258c598e375d48300c065e35cf5aca56bf2aa9
|
File details
Details for the file github_sync_agent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: github_sync_agent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34df821681dba682358b9d2c2d6f2f8b80aa093827a03edc400e6b7ba769147a
|
|
| MD5 |
b92ee280f2d95d21d204f53f09b254bb
|
|
| BLAKE2b-256 |
b4b7b1ad1264eda9d8c3b8d58b20f4851c06938f9a1343553db07e48df288f2d
|