Skip to main content

A uvx-friendly CLI for syncing local files with GitHub repository files

Project description

gitcp

gitcp is a uv/uvx-friendly CLI that syncs local files and directories with files in a GitHub repository.

Commands

uvx gitcp setting                 # interactive login/logout/status/repo/branch settings
uvx gitcp setting login           # non-interactive login options are also available
uvx gitcp setting branch feature  # change the configured branch for the active account
uvx gitcp <file-or-dir>           # upload only if local differs from GitHub
uvx gitcp <local-file-or-dir> :<remote>  # upload to default repo if different
uvx gitcp :<remote> <local>       # download from default repo
uvx gitcp status                  # show current settings

GitHub paths use scp-like prefixes:

  • :path uses the configured default repo, e.g. doehyunbaek/private:path
  • repo:path uses a repo under the default owner, e.g. privatee:path -> doehyunbaek/privatee:path
  • owner/repo:path uses an explicit repo, e.g. doehyunbaekk/privatee:path
  • github:path and gh:path are aliases for :path

In one-argument upload mode, absolute local paths keep their full path inside the repository without the leading slash; for example ~/.pi/agent/multicodex.json syncs to home/you/.pi/agent/multicodex.json. Passing a directory uploads every file under that directory while preserving relative paths; changed files are packed with git and pushed as one commit. In one-argument download mode, :path copies from the configured repo/branch to an absolute local output path; :~/.pi/agent/multicodex.json reads home/you/.pi/agent/multicodex.json from GitHub and writes to ~/.pi/agent/multicodex.json.

Setup flow

The uvx gitcp setting flow is modeled after gh auth login/logout:

  • pick GitHub.com or another GitHub Enterprise hostname
  • choose Login with a web browser by default, matching gh auth login
  • alternatively paste a token, read one with --with-token, or use GCP_TOKEN/GH_TOKEN/GITHUB_TOKEN
  • validate the token by reading the current GitHub user
  • choose the sync repository (owner/repo), branch, and optional remote directory
  • logout removes only local config; it does not revoke GitHub tokens

Token scope needed for private repositories and writes: repo.

Directory uploads use the local git executable to create and push one packed commit. Local blob hashes are cached under ~/.cache/gcp (or GCP_CACHE_DIR) so repeated no-change syncs avoid rereading every file.

Examples

# Install/run from this checkout during development
uv run --project . gitcp --help
uv run --project . gitcp setting

# Login with a browser and configure a repo
uv run --project . gitcp setting login --web -r owner/repo -b main

# Store a token from stdin and configure a repo
printf '%s' "$GH_TOKEN" | uv run --project . gitcp setting login --with-token -r owner/repo -b main

# Change only the configured branch
uv run --project . gitcp setting branch feature

# Push README.md to owner/repo:README.md only if different
uv run --project . gitcp README.md

# Push a directory recursively
uv run --project . gitcp ~/AutoGPT

# Push to an explicit remote path
uv run --project . gitcp README.md :README.md

# Pull README.md from GitHub to ./README.md
uv run --project . gitcp :README.md README.md --force

# Short forms
uv run --project . gitcp local.txt privatee:notes/local.txt
uv run --project . gitcp doehyunbaekk/privatee:notes/local.txt local.txt

Configuration

Config is stored at:

~/.config/gcp/config.json

Override it with GCP_CONFIG or GCP_CONFIG_DIR.

Testing

uv run --project . python -m unittest discover -s tests -v

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

gitcp-0.3.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitcp-0.3.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file gitcp-0.3.0.tar.gz.

File metadata

  • Download URL: gitcp-0.3.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4d5db990d45d0ff6a4c7dffc713aa6e1f2dc9444187a66137ead3a5dca6b37a0
MD5 639e77ae0c90b559dd15e82ea843e2aa
BLAKE2b-256 e23aac5e280516179034cd94b23cbb076bd6bc89513e4110933018ab2ec03083

See more details on using hashes here.

File details

Details for the file gitcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gitcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71596f47ecb895a95ae0844dbbb42ba4c3b82d1fbf37acaff5e57337f2f72398
MD5 f0409c6e8b69174d5b69f6e92c60ba8d
BLAKE2b-256 d295e7632ffc103e2d9fa927757ac917a4bb7cf1f935a1831ecfa5686becb78a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page