Skip to main content

Git clone/fetch/pull/push over SSH using dulwich + paramiko

Project description

sshgit

Git remote operations (clone, fetch, pull, push) over SSH. Built on dulwich and paramiko.

Installation

pip install sshgit

Usage

sshgit clone <remote-path> [dest]

Clone a remote repository over SSH.

sshgit clone /home/me/project.git --host devbox --username me
sshgit clone /srv/repos/app.git --host 10.0.1.5 --port 2222 --ed25519-key ~/.ssh/id_ed25519
sshgit clone /home/me/repo.git ./local-repo --host myserver --username deploy --password
sshgit clone /opt/repos/lib.git --host bastion --rsa-key ~/.ssh/id_rsa --branch main
Flag Description
--host HOST Remote hostname or IP (required)
--username USER SSH username (required)
--port PORT SSH port (default: 22)
--password PASS SSH password
--ed25519-key PATH Path to Ed25519 private key
--rsa-key PATH Path to RSA private key
--branch NAME Branch to check out (default: remote HEAD)

sshgit fetch [refspec]

Fetch objects and refs from the remote. Reads connection details from .git/config.

sshgit fetch
sshgit fetch main
sshgit fetch --prune
Flag Description
--prune Remove stale remote-tracking refs

sshgit pull [branch]

Fetch and fast-forward the current branch. Refuses if the branch has diverged.

sshgit pull
sshgit pull main

sshgit push [refspec]

Push local commits to the remote.

sshgit push
sshgit push main
sshgit push --force
sshgit push --tags
Flag Description
--force Allow non-fast-forward updates
--tags Push all tags

Authentication

One of --ed25519-key, --rsa-key, or --password is required on every invocation. No implicit agent or config file lookup.

Flag Description
--ed25519-key PATH Path to Ed25519 private key
--rsa-key PATH Path to RSA private key
--password PASS SSH password

Jump Host (Proxy)

All commands accept these optional flags for connecting through a bastion host:

Flag Description
--proxy-host HOST Jump host hostname or IP
--proxy-port PORT Jump host SSH port (default: 22)
--proxy-username USER Jump host username (defaults to target username)
--proxy-ed25519-key PATH Ed25519 key for jump host
--proxy-rsa-key PATH RSA key for jump host
--proxy-password PASS Jump host password

Contributing

Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

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

sshgit-0.1.0a1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

sshgit-0.1.0a1-py2.py3-none-any.whl (9.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sshgit-0.1.0a1.tar.gz.

File metadata

  • Download URL: sshgit-0.1.0a1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sshgit-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 4a4246659264130a345014d134df12eefe7586026368a9d4b80a7efd7c1ed1ac
MD5 f087f7702b07273126925741e9205c15
BLAKE2b-256 554d76fa4dd4067db0d96d0df952fc90bfd734cb2253d02ad3c568191a4ac10a

See more details on using hashes here.

File details

Details for the file sshgit-0.1.0a1-py2.py3-none-any.whl.

File metadata

  • Download URL: sshgit-0.1.0a1-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for sshgit-0.1.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a1e68293e7a0f697a895ae787679380ce54aec86d89d078d2b1116a452b69383
MD5 70ac0cf872a353f567ace35a9a429dcb
BLAKE2b-256 76595579a7d022247a69ecf4ef92ce8063120adae7bce59a7bf3e24a6f66ad01

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