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.0a0.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.0a0-py2.py3-none-any.whl (9.9 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for sshgit-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 4d83e3cf83b748c2892342c18b3e60bdc5d204421c693439eed400b7dac2de63
MD5 17d3baaccc37f512bf319f1482da4fed
BLAKE2b-256 a27d4022fbae24c9a58f732a4a2708bda258d1eee7e9dc3fc12804dad6461e52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sshgit-0.1.0a0-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.12.7

File hashes

Hashes for sshgit-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4a3aa68c271b6dca3ffea665d49fa53a790b6058a84348038d40f2ad6b0e1407
MD5 73ae8c3a670aeec1ef66c398ad230c59
BLAKE2b-256 1be66b5f55676754b264d3a6e80e126adb21aa5a05b319cf974fd73859e312c6

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