Markus Michalski FAQ

git-sync-all: Installation

Installing git-sync-all on Linux, macOS and Windows: symlink, copy via make, PowerShell installer, git alias, requirements and uninstall.

Deutsche Version

Back to overview

git-sync-all: Installation

Requirements

Component Requirement Note
Bash 4.3 or newer, 4.4 recommended The code uses namerefs (local -n, since 4.3) and associative arrays. Empty arrays under set -u expand without error only from 4.4. The default macOS Bash 3.2 is not enough.
Git 2.17 or newer recommended With older versions the tool prints a warning and keeps running.
GNU tools find, sort, grep with -P The code uses find -print0, sort -z and grep -oP.
make any Only for make link and make install.
GitHub CLI (gh) any, optional Only for --issues and for clone hints in --verify.
Git for Windows current Windows only. The tool runs on the bundled bash.exe.

Linux and macOS

The symlink points to bin/git-sync-all inside the cloned repository. The script resolves the symlink at runtime and finds lib/ on its own. After a git pull the new version is active immediately.

git clone https://github.com/markus-michalski/git-sync-all.git
cd git-sync-all
make link PREFIX=$HOME/.local

Without PREFIX the Makefile uses /usr/local and creates the link in /usr/local/bin, which usually needs root. Make sure ~/.local/bin is in your PATH.

Copy to /usr/local

sudo make install

make install copies bin/git-sync-all to $PREFIX/bin and all lib/*.sh files to $PREFIX/lib/git-sync-all/. It rewrites the library path inside the installed binary. After a git pull you have to run make install again.

Copy without sudo

make install PREFIX=$HOME/.local

The example files in config/ are not installed by make install. In that case --init-config writes a short built-in configuration and --init-inventory generates the inventory from the repositories it finds. With the symlink setup the full example files are copied instead.

Windows

Windows has no make. The PowerShell installer install.ps1 locates the bash.exe of Git for Windows, creates a Bash forwarder and a .cmd shim, and adds the directory to your user PATH.

git clone https://github.com/markus-michalski/git-sync-all.git
cd git-sync-all
.\install.ps1
Parameter Effect
-Prefix PATH Target directory. Default: %LOCALAPPDATA%\Programs\git-sync-all
-Link Copies nothing and points at this clone instead. git pull updates the installation.
-NoPathUpdate Leaves the user PATH untouched.
-Uninstall Removes the installation again.

If PowerShell blocks the script, run it with powershell -ExecutionPolicy Bypass -File .\install.ps1. Open a new terminal after installing.

On Windows, paths in SYNC_BASE_DIRS must use Git Bash syntax, for example /c/Users/you/projekte. A drive letter such as C:/... breaks because the colon separates the entries.

Git alias git check

git-sync-all --setup-alias

The command sets the global alias.check to the absolute path of the binary. If the alias already exists the tool prints a warning and does not overwrite it. Afterwards you can start the tool with git check.

First steps

git-sync-all --version
git-sync-all --init-config
git-sync-all --dry-run

--init-config creates ~/.config/git-sync-all/config.conf and opens it in an editor when the terminal is interactive and $EDITOR (otherwise $VISUAL, otherwise nano) exists. See Configuration for details.

Uninstall

make uninstall PREFIX=$HOME/.local
sudo make uninstall
git config --global --unset alias.check

make uninstall removes the binary or symlink and the directory $PREFIX/lib/git-sync-all. Configuration and inventory in ~/.config/git-sync-all/ stay in place and have to be deleted by hand if you want them gone. On Windows, .\install.ps1 -Uninstall removes the installation.