Error message on Bench Update

While updating I got the bellow error. First time to get this during an update.

root@work:~# bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages frappe
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date. erpnext
    remote: Counting objects: 70, done.
    remote: Compressing objects: 100% (37/37), done.
    remote: Total 70 (delta 44), reused 25 (delta 25), pack-reused 8
    error: insufficient permission for adding an object to repository database .git/objects
    fatal: failed to write object
    fatal: unpack-objects failed
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
    File “/home/frappe/bench-repo/bench/”, line 40, in cli
    File “/usr/local/lib/python2.7/dist-packages/click/”, line 664, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/”, line 644, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/”, line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/”, line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/”, line 464, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/bench-repo/bench/commands/”, line 62, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
    File “/home/frappe/bench-repo/bench/commands/”, line 78, in _update
    pull_all_apps(bench_path=bench_path, reset=reset)
    File “/home/frappe/bench-repo/bench/”, line 146, in pull_all_apps
    remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
    File “/home/frappe/bench-repo/bench/”, line 127, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: git pull upstream master

Have you made any changes to code?

Have you tried from frappe-bench folder?

Have you tried being non-root?

Please find below. Issue still there

Have we made any changes to code? No
Have we tried from frappe-bench folder? Yes
Have we tried being non-root? Yes

Switch to a normal user.
Then, from your frappe-bench/apps/erpnext folder run this command:

sudo chown -R $USER:$USER "$(git rev-parse --show-toplevel)/.git"

Let me try this.

This is the output:

frappe@work:~/frappe-bench/apps/erpnext$ sudo chown -R $USER:$USER “$(git rev-parse --show-toplevel)/.git”
[sudo] password for frappe:
Sorry, user frappe is not allowed to execute ‘/bin/chown -R frappe:frappe /home/frappe/frappe-bench/apps/erpnext/.git’ as root on work.


Anyone please help me in resolving the issue. Situation is becoming critical because of this.

kindly help !!!

I think the user frappe is not allowed to run sudo commands. Try googling how to add user as a sudo user.
Ref: linux - sudo: Sorry, user root is not allowed to execute - Super User