Private repo pages fail due to unnecessary adding of repo_name/ to hyperlink (GitHub pages)

Related GitHub issue: https://github.com/fastai/nbdev/issues/444
I was not sure if this was a bug, so I reported it there as well.


Following a combination of the tutorial and example from the docs:

Private repo problem

I created a deck_of_cards_nbdev repository. The only change I made is that the repository is private.
When the repository is private, instead of getting a website link in the format of: https://username.github.io/repo_name/,
the format is: https://random-name-64892e2e.pages.github.io/ (note the lack of repo_name).

The index page works fine, but when I for example click on “Card” in the menu, the page wants to navigate me to: https://random-name-64892e2e.pages.github.io/deck_of_cards_nbdev/cards.html.
Due to this appending of deck_of_cards_nbdev, the link does not work.

It should instead be: https://random-name-64892e2e.pages.github.io/cards.html (manually going here works).

Question

How do I prevent this appending of “repo_name/” to all links on GitHub pages made from a private repository?

Note

Locally (with make docs_serve) the links work fine: http://127.0.0.1:4000/deck_of_cards_nbdev/cards.html

I tried to use the Enterprise GitHub variables in settings.ini, but that gave errors like:

Run pip install nbdev jupyter
  pip install nbdev jupyter
  pip install -e .
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.8/x64
Collecting nbdev
  Downloading nbdev-1.1.13-py3-none-any.whl (46 kB)
Collecting jupyter
  Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
# ... snip ...
Using legacy 'setup.py install' for pandocfilters, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyrsistent, since package 'wheel' is not installed.
Installing collected packages: ipython-genutils, wcwidth, traitlets, six, pyrsistent, pyparsing, ptyprocess, parso, attrs, webencodings, tornado, pyzmq, python-dateutil, pygments, pycparser, prompt-toolkit, pickleshare, pexpect, packaging, MarkupSafe, jupyter-core, jsonschema, jedi, decorator, backcall, testpath, pandocfilters, nbformat, mistune, jupyter-client, jinja2, ipython, entrypoints, defusedxml, cffi, bleach, terminado, Send2Trash, prometheus-client, nbconvert, ipykernel, argon2-cffi, notebook, widgetsnbextension, qtpy, jupyterlab-widgets, fastcore, qtconsole, pyyaml, jupyter-console, ipywidgets, ghapi, jupyter, fastrelease, nbdev
    Running setup.py install for pyrsistent: started
    Running setup.py install for pyrsistent: finished with status 'done'
    Running setup.py install for pandocfilters: started
    Running setup.py install for pandocfilters: finished with status 'done'
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 argon2-cffi-20.1.0 attrs-20.3.0 backcall-0.2.0 bleach-3.3.0 cffi-1.14.5 decorator-4.4.2 defusedxml-0.7.0 entrypoints-0.3 fastcore-1.3.19 fastrelease-0.1.11 ghapi-0.1.16 ipykernel-5.5.0 ipython-7.21.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 jedi-0.18.0 jinja2-2.11.3 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-6.1.11 jupyter-console-6.2.0 jupyter-core-4.7.1 jupyterlab-widgets-1.0.0 mistune-0.8.4 nbconvert-5.6.1 nbdev-1.1.13 nbformat-5.1.2 notebook-6.2.0 packaging-20.9 pandocfilters-1.4.3 parso-0.8.1 pexpect-4.8.0 pickleshare-0.7.5 prometheus-client-0.9.0 prompt-toolkit-3.0.16 ptyprocess-0.7.0 pycparser-2.20 pygments-2.8.1 pyparsing-2.4.7 pyrsistent-0.17.3 python-dateutil-2.8.1 pyyaml-5.4.1 pyzmq-22.0.3 qtconsole-5.0.2 qtpy-1.9.0 six-1.15.0 terminado-0.9.2 testpath-0.4.4 tornado-6.1 traitlets-5.0.5 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1
Obtaining file:///home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev
    ERROR: Command errored out with exit status 1:
     command: /opt/hostedtoolcache/Python/3.8.8/x64/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev/setup.py'"'"'; __file__='"'"'/home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-u2ddpf_e
         cwd: /home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev/
    Complete output (13 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev/setup.py", line 39, in <module>
        url = cfg['git_url'],
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/configparser.py", line 1255, in __getitem__
        return self._parser.get(self._name, key)
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/configparser.py", line 799, in get
        return self._interpolation.before_get(self, section, option, value,
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/configparser.py", line 395, in before_get
        self._interpolate_some(parser, option, L, value, section, defaults, 1)
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/configparser.py", line 434, in _interpolate_some
        raise InterpolationMissingOptionError(
    configparser.InterpolationMissingOptionError: Bad value substitution: option 'git_url' in section 'DEFAULT' contains an interpolation key 'repo_name' which is not a valid option name. Raw value: 'https://github.%(company_name)s.com/%(repo_name)s/%(lib_name)s/tree/%(branch)s/'
    ----------------------------------------
WARNING: Discarding file:///home/runner/work/deck_of_cards_nbdev/deck_of_cards_nbdev. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Error: Process completed with exit code 1.

Replacing:

doc_baseurl = /%(lib_name)s/

with

doc_baseurl = /

Results in:

Run if [ -n "$(nbdev_diff_nbs)" ]; then echo -e "!!! Detected difference between the notebooks and the library"; false; fi
  if [ -n "$(nbdev_diff_nbs)" ]; then echo -e "!!! Detected difference between the notebooks and the library"; false; fi
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.8/x64
!!! Detected difference between the notebooks and the library
Error: Process completed with exit code 1.
1 Like

Changing to doc_baseurl = / in settings.ini actually did work. I forgot to rerun:

nbdev_build_lib
nbdev_build_docs
3 Likes