Error when updating ERPNext V13 to latest version

Good Day ERPnext community.

I’m trying to update my bench with {sudo bench update}. When I do that I get the following error.

ERROR: Command ‘basename $(git symbolic-ref -q HEAD)’ returned non-zero exit status 1.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/update.py”, line 23, in update
update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, compile=not no_compile, force=force, reset=reset)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py”, line 376, in update
validate_branch()
File “/usr/local/lib/python3.8/dist-packages/bench/utils/bench.py”, line 570, in validate_branch
branch = get_current_branch(app)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/app.py”, line 165, in get_current_branch
return get_cmd_output(“basename $(git symbolic-ref -q HEAD)”, cwd=repo_dir)
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 185, in get_cmd_output
output = subprocess.check_output(
File “/usr/lib/python3.8/subprocess.py”, line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/usr/lib/python3.8/subprocess.py”, line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘basename $(git symbolic-ref -q HEAD)’ returned non-zero exit status 1.

I am running the bench on an HP ProLiant server, and it’s running in production mode. I have made sure there aren’t any changes that need saving.

Any suggestions on what could be causing this?

Hi,

It may help to say the operating environment , whether ERPNext has been updated successfully in the past and why the update is being done using sudo.

Hi @Michael_Creevy,

  1. In a terminal, change your working directory to the one where the Frappe App is stored. It’s usually something like this:

../frappe-bench/apps/frappe

The correct directory has contents similar to this:

  1. Execute this shell command, precisely:
basename $(git symbolic-ref -q HEAD)

What’s the result of that command?