1 pygitsync
A utility to poll a remote git repository and maintain local state according simple rules such as the HEAD of a specified branch, or the latest tag conforming to a regular expression.
1.1 Installation
The pygitsync package is available from PyPI. Installing into a virtual environment is recommended.
python3 -m venv .venv; .venv/bin/pip install pygitsync
1.2 Credential management
One relatively straight-forward means of managing credentials for SSH based access to git repositories is using ssh-agent. Before starting the git-sync process, take the following steps.
eval $(ssh-agent)
ssh-add <path to keyfile to be used by pygitsync>
# type the passphrase for your SSH key as prompted
git-sync [options]
git-sync will now use the ssh agent session to acquire access to the SSH key.
Having a human type in a passphrase may not work very well for automation, so further effort will likely be needed to automatically acquire the passphrase from some kind of encrypted vault, and then apply that passphrase to the ssh agent session. A work-around may be to use an empty-passphrase SSH key, but this is not recommended at all for maintaining good security.
1.3 Getting started
Having just installed pygitsync you really just want to get a remote repo syncing, right? You need to create a configuration file - the default location is .pygitsync.yaml and it needs to look something like this. In this case we’re just syncing the default (main) branch of the pygitsync repo itself.
---
repo:
pattern_type: branch
pattern: main
url: git@gitlab.com:ci-cd-devops/pygitsync.git
application:
exception_sleep_seconds: 10
is_daemon: false
sleep_interval_seconds: 30
Using this configuration the remote repo will be pulled every 30 seconds to check for updates in the main branch. The pattern type “branch” means that the sync will always update to the latest HEAD pulled from the remote. Disabling the is_daemon setting means that the process will run indefinitely in the foreground (useful to run inside containers).
Running indefinitely means that the process will never exit for exceptions. If an exception occurs very early in the process then the exception handling loop could run very quickly, consuming large amounts of needless CPU. The exception_sleep_seconds setting puts a delay in that exception handling oop to prevent such a scenario from occurring.
The repo will be initially be cloned to the current working directory of the git-sync executable, or use the --working argument to specify an alternate location for the repo working directory.
Take a look at other configuration arguments using git-sync --help.
Metadata
Release files for pygitsync 0.2.0.post2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygitsync-0.2.0.post2.tar.gz | 20.3 kB | Without provenance | Details for pygitsync-0.2.0.post2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygitsync-0.2.0.post2-py3-none-any.whl | Python 3 | none | any | Details for pygitsync-0.2.0.post2-py3-none-any.whl |
Total release size: 33.5 kB
Release files / pygitsync-0.2.0.post2.tar.gz
| Download URL | pygitsync-0.2.0.post2.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e321d919b5c57795d51f4ca93d07792e0235320dee11b86c6f3d67e727ad623
|
|
BLAKE2b-256 checksum How to use checksums |
577ebb65d93982669cd1bd192ea1a9614ab5f7eba7443b9e812aba43e4a5f6e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.15
|
Release files / pygitsync-0.2.0.post2-py3-none-any.whl
| Download URL | pygitsync-0.2.0.post2-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a34f2ed7422f807f2d21caa0247b256246c170b40ecd5d8539d6491f69c8897f
|
|
BLAKE2b-256 checksum How to use checksums |
7bb24b7a3f712f0dc5e60990295252ec6cc9b208eef51705b91b6a1c193d100b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.15
|
Security for pygitsync 0.2.0.post2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.