Several npm packages specify git repositories as dependencies (e.g., "package": "git+https://github.com/..."). When npm encounters these, it shells out to git to clone the repository. Inside the proot Ubuntu environment, git isn't available — apt install git fails because dpkg's ARM32 support in proot is broken for packages with complex post-install scripts.
However, proot works by bind-mounting the host filesystem. Termux's native binaries at /data/data/com.termux/files/usr/bin/ are accessible from inside proot at the same path. We can create a wrapper script that redirects git calls to Termux's native git binary.
This hack is LEGACY — superseded by native gateway migration (Hack #12) which doesn't use proot.
Create a wrapper script inside the proot environment that calls through to Termux's native git:
# Inside proot (proot-distro login ubuntu):
# Create the wrapper directory
mkdir -p /usr/local/bin
# Create the git wrapper
cat > /usr/local/bin/git << 'EOF'
#!/bin/bash
# Git bridge — calls Termux's native git through proot bind mount
exec /data/data/com.termux/files/usr/bin/git "$@"
EOF
# Make it executable
chmod +x /usr/local/bin/gitVerify that /usr/local/bin is in the PATH (it should be by default on Ubuntu):
# Check PATH includes /usr/local/bin
echo $PATH | tr ':' '\n' | grep local
# Expected: /usr/local/bin
# If not, add to .bashrc:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc# Inside proot — test the wrapper:
git --version
# Expected: git version 2.x.x (Termux's version)
# Test that npm can use git:
npm ls 2>&1 | head -5
# Expected: no "git not found" errors
# Test a git clone operation:
git clone --depth 1 https://github.com/test/repo.git /tmp/test-repo
# Expected: successful clone| Metric | Before | After |
|---|---|---|
| git inside proot | Not available | Working via bridge |
| npm git dependencies | Fail | Install correctly |
| Extra disk space | 0 | 0 (just a script) |