scripts for managing repositories between two devices
2026-06-14 17:01:30 -03:00
.gitignore add .gitignore 2026-04-03 16:14:06 -03:00
bare_to_repo chore: disable debugging in some functions to reduce verbosity in loops 2026-06-03 21:20:37 -03:00
clone fix(clone): clone from server repos 2026-06-03 21:24:24 -03:00
configure_client chore: disable debugging in some functions to reduce verbosity in loops 2026-06-03 21:20:37 -03:00
configure_server chore: disable debugging in some functions to reduce verbosity in loops 2026-06-03 21:20:37 -03:00
LICENSE initial commit 2026-04-03 15:49:04 -03:00
mirror_to chore: remove remaining files arrays and enable debugging 2026-06-03 20:55:52 -03:00
not_clean feat: add script to find what repositories are not clean 2026-06-14 17:01:30 -03:00
README.md chore(readme): encourage reading the source code 2026-06-03 20:45:26 -03:00
repo_to_bare chore: disable debugging in some functions to reduce verbosity in loops 2026-06-03 21:20:37 -03:00
run chore: disable debugging in some functions to reduce verbosity in loops 2026-06-03 21:20:37 -03:00
vars fix(vars): fail early if required variables are not set 2026-06-03 21:42:20 -03:00

git-scripts

This repository contains several useful scripts written in Bash, that allows easier management of repositories between two devices.

Note this is somewhat personal, so you will have to tweak it a little bit before using.

Motivation

In the current days, relying on the many git remote providers is not really a great deal, specially if you want to host some more sensitive data or code, which should have the least breaches as possible. This is specially true with proprietary providers, which you already know that uses your data for training AI, house holding your private data without consent and so on.

This is a simple approach without dependence on anything else but ssh and git, so that we can have a git server in one device and them work with it.

You are encouraged to read all scripts.

Standalone Scripts

bulk.sh

Run bulk operations (local) in all repositories.

single.sh

Run a single operation (local) in a chosen repository.

repo_to_bare.sh

Makes a bare repository from a normal.

bare_to_repo.sh

Makes a normal repository from a bare.

How to use

You will have to configure repo.ini before using. The client_name and server_name are assumed to be defined in your ssh .config file.

current=client

# Absolute path
client=/home/aoc/.secrets/unencrypted
server=/data/data/com.termux/files/home

client_name=desktop
server_name=phone
# .ssh/config
Host desktop
    User username
    HostName <IP ADDRESS / LOCAL ADDRESS>
    Port 22
    IdentityFile ~/.ssh/id_rsa
Host phone
    HostName <IP ADDRESS / LOCAL ADDRESS>
    Port 8022
    IdentityFile ~/.ssh/id_rsa

After that, in your server, you must turn all repositories into a bare repository using the repo_to_bare.sh, which will create them in ~/git/server. Then you can use configure_server to add a server remote in all repositories in ./repos to your own server, and configure_remote to do the same.

After that you can operate as usual. To interact with your server you would do: git fetch server, git push server...

License

This repository is licensed under the Unlicense license.