When updating bench - CommandFailedError: git pull upstream develop

Good day

When I am Trying to update bench --pull it give me error below I have made some changes on quotation and sales module the erro is :

  • branch develop → FETCH_HEAD
    Updating 4b12740…f34e631
    error: Your local changes to the following files would be overwritten by merge:
    erpnext/selling/doctype/quotation/quotation.json
    erpnext/selling/doctype/quotation_item/quotation_item.json
    erpnext/selling/doctype/sales_order/sales_order.json
    erpnext/stock/doctype/item/item.json
    Please, commit your changes or stash them before you can merge.
    Aborting
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.92’, ‘console_scripts’, ‘bench’)()
    File “/home/administrator/bench-repo/bench/cli.py”, line 60, in cli
    bench()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 695, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 675, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1039, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 868, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 513, in invoke
    return callback(*args, **kwargs)
    File “/home/administrator/bench-repo/bench/cli.py”, line 240, in _update
    update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
    File “/home/administrator/bench-repo/bench/cli.py”, line 259, in update
    pull_all_apps(bench=bench_path)
    File “/home/administrator/bench-repo/bench/app.py”, line 88, in pull_all_apps
    exec_cmd(“git pull {rebase} upstream {branch}”.format(rebase=rebase, branch=get_current_branch(app, bench=bench)), cwd=app_dir)
    File “/home/administrator/bench-repo/bench/utils.py”, line 104, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: git pull upstream develop

Also when running bench update it give me this error:
administrator@ubuntu:~/frappe-bench/sites$ bench update
error: cannot open .git/FETCH_HEAD: Permission denied

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.92’, ‘console_scripts’, ‘bench’)()
File “/home/administrator/bench-repo/bench/cli.py”, line 60, in cli
bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 695, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 675, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1039, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 868, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 513, in invoke
return callback(*args, **kwargs)
File “/home/administrator/bench-repo/bench/cli.py”, line 229, in _update
update_bench()
File “/home/administrator/bench-repo/bench/utils.py”, line 219, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/administrator/bench-repo/bench/utils.py”, line 104, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

You clearly have local changes. You need to stash them or commit them or resolve conflicts. Learn more about git at: Set up Git - GitHub Docs

New error and also when I start the bench the app not login

administrator@ubuntu:~$ bench retry-upgrade

From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch v5.x.x → FETCH_HEAD
    Already up-to-date.
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch develop → FETCH_HEAD
    Updating 4b12740…aabefe4
    error: Your local changes to the following files would be overwritten by merge:
    erpnext/selling/doctype/quotation/quotation.json
    erpnext/selling/doctype/quotation_item/quotation_item.json
    erpnext/selling/doctype/sales_order/sales_order.json
    erpnext/stock/doctype/item/item.json
    Please, commit your changes or stash them before you can merge.
    Aborting
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.92’, ‘console_scripts’, ‘bench’)()
    File “/home/administrator/bench-repo/bench/cli.py”, line 60, in cli
    bench()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 695, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 675, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1039, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 868, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 513, in invoke
    return callback(*args, **kwargs)
    File “/home/administrator/bench-repo/bench/cli.py”, line 288, in retry_upgrade
    pull_all_apps()
    File “/home/administrator/bench-repo/bench/app.py”, line 88, in pull_all_apps
    exec_cmd(“git pull {rebase} upstream {branch}”.format(rebase=rebase, branch=get_current_branch(app, bench=bench)), cwd=app_dir)
    File “/home/administrator/bench-repo/bench/utils.py”, line 104, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: git pull upstream develop
1 Like

I think this will solve it:
If when running bench update get error like this:

bench.utils.CommandFailedError: git pull

Do the following if you haven’t made local changes to files in the application:

  1. go to folder /home/frappe/frappe-bench/apps/erpnext
    and run the following command:
git reset --hard
git pull
  1. go to folder /home/frappe/frappe-bench/apps/frappe
    and run the following command:
git reset --hard
git pull
  1. go to folder /home/frappe/.bench
    and run the following command:
git reset --hard
git pull
  1. Finally goto /home/frappe/frappe-bench
    and run:
bench update
16 Likes