A package manager for installing and managing applications from git repositories. GitPM allows you to maintain a list of git repositories and easily install, update, and remove them with automatic dependency management and script execution.
- Config-based repository management: Maintain lists of git repositories in config files
- Multiple config files: Support for multiple config files (user and system-wide)
- Branch support: Install specific branches with custom names
- Dependency management: Automatic checking and installation of system and gitpm dependencies
- Script execution: Automatic execution of setup, update, check, and removal scripts
- User/System installs: Support for both user (
~/.local/share/apps) and system (/opt/apps) installations - Update checking: Check for updates with custom scripts or git commit comparison
- Compatibility checking: Ensures repositories are marked as gitpm-compatible
- Make the script executable:
chmod +x gitpm.py- Optionally move it to your PATH:
sudo cp gitpm.py /usr/local/bin/gitpmCreate config files to list available repositories. GitPM will automatically load all files matching repos*.conf from:
- User config:
~/.config/gitpm/repos*.conf - System config:
/etc/xdg/gitpm/repos*.conf
Each line in the config file can be:
- Simple URL:
https://github.com/user/repo.git - With branch:
https://github.com/user/repo.git,branch-name - With branch and custom name:
https://github.com/user/repo.git,branch-name,custom-name
Examples:
# Simple format
https://github.com/user/app1.git
# With branch
https://github.com/user/app1.git,develop
# With branch and custom name (allows multiple installs from same repo)
https://github.com/user/app1.git,develop,dev-version
https://github.com/user/app1.git,main,stable-version
# SSH format
git@github.com:user/app2.git
# Short format (assumes GitHub)
user/repo
Repositories must include a marker file to be considered compatible:
.gitpm(empty file is fine)gitpm.json(can contain metadata).gitpm.json(can contain metadata)
Use --force flag to skip compatibility check and install anyway.
Repositories can include a gitpm.json file with dependency information:
{
"system_only": false,
"dependencies": {
"system": {
"method": "sudo pacman -S --noconfirm",
"Arch": [
"distrobox",
["docker", "podman"]
],
"Debian": [
"distrobox",
["docker", "podman"]
],
"Fedora_method": "sudo dnf install -y",
"Fedora": [
"distrobox",
["docker", "podman"]
]
},
"gitpm": [
"https://github.com/user/dependency1.git",
"https://github.com/user/dependency2.git,branch,custom-name",
[
"https://github.com/user/alt1.git",
"https://github.com/user/alt2.git,branch,alt-name"
]
]
}
}system_only: Iftrue, package can only be installed system-wide (requires--systemflag)dependencies.system: System package dependenciescheck_commands: Maps commands to check (e.g.,"docker") to package names that provide them- Arrays indicate multiple packages can provide the same command (e.g.,
["docker", "podman"]) - GitPM checks if the command exists (using
-vflag), not the package name
- Arrays indicate multiple packages can provide the same command (e.g.,
- Distro sections (Arch, Debian, Fedora, etc.): Maps command names to distro-specific package names
- Example:
"docker": "docker.io"on Debian means thedockercommand comes from thedocker.iopackage - This allows the same command check across distros while using correct package names per distro
- Example:
method: Install command (e.g.,"sudo pacman -S --noconfirm"){Distro}_method: Per-distro install method override- Legacy format: Arrays are still supported for backward compatibility
dependencies.gitpm: GitPM package dependencies (same format as repos.conf)- Can be a string:
"https://github.com/user/dep.git" - Can be an array of alternatives:
["https://github.com/user/alt1.git", "https://github.com/user/alt2.git"] - If an array, any one of the packages satisfies the dependency
- Can be a string:
# User install (default)
./gitpm.py install appname
# System install (requires root)
sudo ./gitpm.py --system install appname
# Skip compatibility check
./gitpm.py install appname --force# Update all packages
./gitpm.py update
# Update specific package
./gitpm.py update appname
# Check for updates without applying them
./gitpm.py update --check
./gitpm.py update appname --check./gitpm.py remove appname# List all (installed and available)
./gitpm.py list
# List only installed
./gitpm.py list --installed
# List only available
./gitpm.py list --available
# Search packages
./gitpm.py list --search query
# Show which config file each package comes from
./gitpm.py list --show-sourceRepositories can include scripts that are automatically executed during operations. Scripts are checked in this order:
- User/system-specific scripts (e.g.,
setup-user.sh,update-system.py) - Generic scripts (e.g.,
setup.sh,update.py)
Run during installation:
setup-user.sh,install-user.sh,setup-user.py,install-user.pysetup-system.sh,install-system.sh,setup-system.py,install-system.pysetup.sh,install.sh,setup.py,install.py
Run when updating a package:
update-user.sh,upgrade-user.sh,update-user.py,upgrade-user.pyupdate-system.sh,upgrade-system.sh,update-system.py,upgrade-system.pyupdate.sh,upgrade.sh,update.py,upgrade.py
If no update script exists, the setup script is re-run as fallback.
Run when checking for updates (--check flag):
check-user.sh,check-updates-user.sh,check-user.py,check-updates-user.pycheck-system.sh,check-updates-system.sh,check-system.py,check-updates-system.pycheck.sh,check-updates.sh,check.py,check-updates.py
Exit codes:
0= No updates available1= Updates available- Other = Error (falls back to git commit comparison)
Run when removing a package:
remove-user.sh,uninstall-user.sh,remove-user.py,uninstall-user.pyremove-system.sh,uninstall-system.sh,remove-system.py,uninstall-system.pyremove.sh,uninstall.sh,remove.py,uninstall.py
GitPM automatically:
- Checks if system packages are installed (using
-vflag) - Supports alternative packages (e.g., docker OR podman)
- Attempts to install missing packages if:
- Installing as system (
--systemflag) - User has sudo access (for user installs)
- Installing as system (
Package names and install methods are distro-specific. GitPM detects your distribution (Arch, Debian, Fedora, etc.) and uses the appropriate package list.
GitPM dependencies are automatically installed before the parent package. They use the same install type (user/system) as the parent package.
If a dependency requires system install (system_only: true), the parent package must also be installed with --system.
- User installs:
~/.local/share/apps/{package-name} - System installs:
/opt/apps/{package-name}
Registry files:
- User:
~/.config/gitpm/installed.json - System:
/etc/gitpm/installed.json
# Add repository to config
echo "https://github.com/user/myapp.git" >> ~/.config/gitpm/repos.conf
# Install
./gitpm.py install myapp# In repos.conf:
https://github.com/user/app.git,develop,dev-version
https://github.com/user/app.git,main,stable-version
# Install both
./gitpm.py install dev-version
./gitpm.py install stable-versionCreate gitpm.json in your repository:
{
"dependencies": {
"system": {
"method": "sudo pacman -S --noconfirm",
"Arch": ["python", "git"]
},
"gitpm": [
"https://github.com/user/required-tool.git"
]
}
}GitPM will automatically install dependencies before installing your package.
{
"system_only": true,
"dependencies": {
"system": {
"Arch": ["systemd"]
}
}
}This package can only be installed with sudo ./gitpm.py --system install package-name.
Add one of these marker files to your repository root:
.gitpmgitpm.json.gitpm.json
Or use --force flag to skip the check.
Install the required packages manually, or install with --system flag if you have root access.
Verify the branch name exists in the repository. Branch names with slashes (e.g., feat/new-feature) are supported.
Check that:
- Install method in
gitpm.jsonis correct for your distribution - Package names are correct for your distribution
- You have necessary permissions (sudo for user installs, root for system installs)
This tool is provided as-is for managing git-based package installations.