URLs with gitlab deploy keys breaks bench?

I use gitlab’s deploy tokens for password-less access to my code. They cause the git URL to look like this:

https://gitlab+deploy-token-1:6IUKBZpFu89nmuLnq6Ja@gitlab.com/user/project.git

When trying to update my code on the server, using bench update, bench fails with the following error message:

$ bench update
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/user/.bench/bench/cli.py", line 41, in cli
    bench_command()
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.bench/bench/commands/update.py", line 25, in update
    update(pull=pull, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, force=force, reset=reset)
  File "/home/user/.bench/bench/utils.py", line 175, in update
    validate_branch()
  File "/home/user/.bench/bench/app.py", line 451, in validate_branch
    branch = get_current_branch(app)
  File "/home/user/.bench/bench/app.py", line 301, in get_current_branch
    return get_cmd_output("basename $(git symbolic-ref -q HEAD)", cwd=repo_dir)
  File "/home/user/.bench/bench/utils.py", line 491, in get_cmd_output
    output = subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=subprocess.PIPE).strip()
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'basename $(git symbolic-ref -q HEAD)' returned non-zero exit status 1.

Running the last command manually seems to succeed as shown below. Any hints as to what is happening?

$ basename $(git symbolic-ref -q HEAD)
devel

I have now replaced the url in my .git/config from the gitlab URL to a local URL as show below. I still see this error.

$ cat apps/project/.git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "upstream"]
        url = /home/user/sources/project/
        fetch = +refs/heads/devel:refs/remotes/upstream/devel
[branch "devel"]
        remote = upstream
        merge = refs/heads/devel