Gitlab integration with JupyterHub

I have a Jupyter Book that I want to be able to launch into JupyterHub from. I used the recommended way to do this. This worked fine on Github, but when I moved the repository to Gitlab something broke. The config file has been updated to use the Gitlab repository URL, but when nbgitpuller tries to access the repository with “git ls-remote --heads <URL>” it fails with a return code of 1 or 127. The command that fails can be run fine in a terminal on either the computer I’m accessing the site with or the computer hosting the JupyterHub server, whether run as root, the jupyterhub account user, or the user I usually log in as. When using a URL, as username and password are requested, so I tried via SSH instead, since no password was needed. Again, it could be run fine from a terminal but nbgitpuller raised an error.

Unfortunately, the only real information I have is the command that fails and the resulting return code—I could not figure out how to log or echo further information.

I found that other people have had issues with launching from Jupyter Books with non-Github repositories. Their error messages are different, but also seem related to the ls-remote command, so it may be a similar error. However, there are no recommended fixes. Another person had issues with Gitlab, though not related to JupyterHub, but the solution recommended by agoose77 did not work.