Skip to content

eikoshelev/git-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-sync

Warning
The use of flags is deprecated! All configuration using environment variables only!

♻️ Easy to use and stable update of your repository.

alt text

Description

Real-time local repository update (every N time):

  1. Auth - Authorization by HTTP (login/password) or SSH (private key);
  2. Clone - When starting, it checks the presence of the repository at the specified path (if the repository already exists, it starts checking for updates, if not, it will first clone);
  3. Fetch - Checks repository updates every N time;
  4. Pull - As soon as the remote repository is updated - makes pull in the specified directory.

Build and run locally

git clone https://github.com/eikoshelev/git-sync.git
cd git-sync && go build ./cmd/git-sync
./git-sync

Docker container

You can run it like this:

docker run -d --name git-sync eikoshelev/git-sync:v2.0.0

..or build your own container:

git clone https://github.com/eikoshelev/git-sync.git
cd git-sync && docker build -t eikoshelev/git-sync:v2.0.0 --platform <OS>/<ARCH> .

Usage

Environment variable Description
GSYNC_REPO_URL URL to remote repository, example: [email protected]:eikoshelev/git-sync.git (SSH),https://github.com/eikoshelev/git-sync.git (HTTP)
GSYNC_REPO_LOCAL_PATH Path to local directory for repository: /path/to/your/local/directory
GSYNC_FETCH_TIMEOUT Timeout for check update (fetch), default 5m, for example 1s, 2m, 3h, etc.
GSYNC_SSH_KEY_PATH Path to private SSH key for auth to the remote repository, default /$HOME/.ssh/id_rsa
GSYNC_SSH_KNOWN_HOSTS Path to known_hosts file for work with remote repository, default /$HOME/.ssh/known_hosts
GSYNC_HTTP_LOGIN Login for HTTP auth to the remote repository
GSYNC_HTTP_PASSWORD Password for HTTP auth to the remote repository
GSYNC_FORCE_PULL Forced pull with changed local repository: allowed - true, not allowed - false (default)
GSYNC_REPO_BRANCH Remote branch for pull, for example: main, develop, etc. NOTE: If the 'tag' is specified, the 'branch' will be ignored!
GSYNC_REPO_TAG Remote tag for clone, for example: "v1.0.0", "v2.0-rc", "v3.0-stable", etc. NOTE: If the 'tag' is specified, the specified 'branch' will be ignored!

What else?

Open an issue or PR if you have more suggestions, questions or ideas about what to add.