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 GITCP_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/gitcp (or GITCP_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/gitcp/config.json

Override it with GITCP_CONFIG or GITCP_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.1.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.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitcp-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e9a014a00653615b3d72db0fdf7b0a2f11df6120958c0fea78f66a3d4f644328
MD5 bc157613e09099108f19de41a34e4c16
BLAKE2b-256 781259db43008e8fc4b6c70cd953516deeaa0b2a09da7b5165901094c5978a2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gitcp-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 865f5922b47b88a918542e5a26b330ece736f83fe481b8c9f37c5fc5ab44d665
MD5 d7c7d55567a8fe6cda59d34d268106be
BLAKE2b-256 a13c14d55e9d582efe8c6dfa55a686cf9511626548200a95e9dea9bdc42587b9

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