Description
When deploying to a gh-pages branch from a repository that uses git submodules, angular-cli-ghpages v3 fails to properly remove existing files from the gh-pages branch. This results in the deployed content containing files from the main branch (like .github/, .gitignore, .gitmodules, and the submodule gitlink) mixed with the intended dist content.
v2 works correctly - it properly removes all existing files before copying the new content.
Steps to Reproduce
- Create a repo with a git submodule (e.g.,
build/ pointing to another repo)
- Have an existing gh-pages branch with some content (or let the first deploy create it)
- Run angular-cli-ghpages v3 with
--dir=dist where dist/ only contains your build output (e.g., blog/)
Expected Behavior
The gh-pages branch should only contain:
.nojekyll
- Contents of
dist/ (e.g., blog/)
Actual Behavior
The gh-pages branch contains:
.nojekyll ✓
blog/ ✓
.github/ ✗ (from main branch)
.gitignore ✗ (from main branch)
.gitmodules ✗ (from main branch)
build ✗ (submodule gitlink, type "commit" in git tree)
Analysis
Looking at the deploy logs, the sequence is:
Cloning repo into cache...
Cleaning
Fetching origin
Checking out origin/gh-pages
Removing files <-- This step doesn't fully clean
Creating .nojekyll
Copying files
Adding all
Committing
Pushing
The "Removing files" step in v3 appears to not properly handle:
- Hidden files (
.gitignore, .gitmodules)
- Hidden directories (
.github/)
- Submodule gitlinks - In git, a submodule is stored as a "commit" type entry in the tree (not a regular file/directory). This might require special handling like
git rm --cached or git submodule deinit.
Workaround
Use v2:
npm install angular-cli-ghpages@2
npx angular-cli-ghpages --dir=dist ...
Environment
Related
This might be related to changes in the bundling/packaging for v3, or changes in the underlying gh-pages npm package dependency.
Description
When deploying to a gh-pages branch from a repository that uses git submodules, angular-cli-ghpages v3 fails to properly remove existing files from the gh-pages branch. This results in the deployed content containing files from the main branch (like
.github/,.gitignore,.gitmodules, and the submodule gitlink) mixed with the intended dist content.v2 works correctly - it properly removes all existing files before copying the new content.
Steps to Reproduce
build/pointing to another repo)--dir=distwheredist/only contains your build output (e.g.,blog/)Expected Behavior
The gh-pages branch should only contain:
.nojekylldist/(e.g.,blog/)Actual Behavior
The gh-pages branch contains:
.nojekyll✓blog/✓.github/✗ (from main branch).gitignore✗ (from main branch).gitmodules✗ (from main branch)build✗ (submodule gitlink, type "commit" in git tree)Analysis
Looking at the deploy logs, the sequence is:
The "Removing files" step in v3 appears to not properly handle:
.gitignore,.gitmodules).github/)git rm --cachedorgit submodule deinit.Workaround
Use v2:
Environment
Related
This might be related to changes in the bundling/packaging for v3, or changes in the underlying
gh-pagesnpm package dependency.