c-w/ghp-import

opt `--no-jekyll` should place `.nojekyll` under `--prefix` directory

achekery opened this issue · 3 comments

Summary

We would expect opt --no-jekyll should place .nojekyll in gh-pages branch under --prefix directory. However, it instead places the file at the root directory. GitHub Pages deployment seems to ignore the .nojekyll file unless it is exactly at the web serving directory (i.e. /docs in my case)

Related source code section:

ghp-import/ghp_import.py

Lines 157 to 160 in 5bf63c4

def add_nojekyll(pipe):
write(pipe, enc('M 100644 inline .nojekyll\n'))
write(pipe, enc('data 0\n'))
write(pipe, enc('\n'))

Commands:

$ ghp-import --version
2.0.2

$  ghp-import \
    --no-jekyll \
    --push \
    --prefix=docs \
    --force \
    --no-history \
    ${BOOK_DIR}/_build/html
 $ git checkout gh-pages ; git pull ; cd $(git rev-parse --show-toplevel); find . -name .nojekyll
./.nojekyll

Current workaround for user

  # https://github.com/c-w/ghp-import/issues/106
  # move .nojekyll under --prefix directory in gh-pages branch
  cd $(git rev-parse --show-toplevel) \
    && git add -A && git stash push \
    && git checkout gh-pages && git pull \
    && git mv ./.nojekyll ./docs/.nojekyll \
    && git commit -m "move .nojekyll file into place" && git push \
    && git checkout - && git stash pop
c-w commented