Git
Technical details of the Git installation phase.
The Git installation phase prepares APPNETOS repositories for execution inside Docker containers.
Its primary responsibility is configuring Git safe directories required by Composer and other Git-based tooling.
The phase is executed automatically before Composer dependencies are installed.
Goals
The Git installation phase has the following responsibilities:
- Detect Git repositories.
- Configure Git safe directories.
- Prevent Git ownership warnings.
- Provide a reproducible development environment.
The phase performs only the required configuration and does not modify repository content.
Background
When Docker bind mounts are used, file ownership inside the container often differs from the ownership on the host system.
Git protects against this situation by refusing to access repositories that appear to be owned by another user.
Typical error message:
fatal: detected dubious ownership in repository
Without additional configuration, Composer may fail because Git cannot access the repository.
Git Safe Directory
APPNETOS automatically registers every discovered application repository as a Git safe directory.
The configuration is performed using:
git config --global \
--add safe.directory \
<application-directory>
Only repositories that require the configuration are modified.
Automatic Detection
The installer checks every discovered APPNETOS application individually.
For each application it determines whether:
- the directory exists,
- the directory is a Git repository,
- the repository is already configured as safe.
Repositories that are already configured are skipped automatically.
Idempotency
The Git installation phase is fully idempotent.
Running the installer multiple times never creates duplicate configuration entries.
Already configured repositories are detected automatically.
Typical installer output:
[INFO] Git safe.directory already configured:
/var/www/appnetos/appnetos
During the first installation:
[ OK ] Git safe.directory configured:
/var/www/appnetos/appnetos
Development Environment
The Git configuration is intended for local development environments running inside Docker containers.
It allows Git and Composer to operate normally without requiring manual configuration after cloning a project.
Summary
The Git installation phase provides:
- Automatic Git repository detection
- Automatic safe.directory configuration
- Composer compatibility
- Fully idempotent execution
- Zero manual Git configuration after cloning