Fatal: refusing to merge unrelated histories

Hi To all
in branch master
when I run bench update or bench update --pull I get the following error

bench@mmerpdemo06:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up to date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (5.2.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe
 * branch                master     -> FETCH_HEAD
Already up to date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling frappe_io
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe_io
 * branch            master     -> FETCH_HEAD
Already up to date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/erpnext
 * branch                  master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/opt/bench/bench-repo/bench/cli.py", line 40, in cli
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/opt/bench/bench-repo/bench/commands/update.py", line 73, in _update
    pull_all_apps(bench_path=bench_path, reset=reset)
  File "/opt/bench/bench-repo/bench/app.py", line 257, in pull_all_apps
    remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
  File "/opt/bench/bench-repo/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull  upstream master

Hi, please refrain from creating new topics for the same issue.

A simple Google search can help:

Try running the following command from the apps/erpnext directory:

git pull upstream master --allow-unrelated-histories
1 Like

thanks for replying

CONFLICT (add/add): Merge conflict in erpnext/startup/boot.py
Auto-merging erpnext/shopping_cart/test_shopping_cart.py
CONFLICT (add/add): Merge conflict in erpnext/shopping_cart/test_shopping_cart.py
Auto-merging erpnext/shopping_cart/product_info.py
CONFLICT (add/add): Merge conflict in erpnext/shopping_cart/product_info.py
Auto-merging erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
CONFLICT (add/add): Merge conflict in erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
Auto-merging erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json
CONFLICT (add/add): Merge conflict in erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json
Auto-merging erpnext/setup/utils.py
CONFLICT (add/add): Merge conflict in erpnext/setup/utils.py
Auto-merging erpnext/setup/setup_wizard/tasks/task_alert.json
CONFLICT (add/add): Merge conflict in erpnext/setup/setup_wizard/tasks/task_alert.json
Auto-merging erpnext/setup/setup_wizard/setup_wizard.py
CONFLICT (add/add): Merge conflict in erpnext/setup/setup_wizard/setup_wizard.py
Auto-merging erpnext/setup/setup_wizard/operations/taxes_setup.py
CONFLICT (add/add): Merge conflict in erpnext/setup/setup_wizard/operations/taxes_setup.py


Are you trying to make changes to the ERPNext app directly? It is recommended to create a custom app instead.

See this post for how to reset the ERPNext app directory. Note that any changes you made in the directory will be lost.

1 Like

no I don’t make any changes
I just installed erpnext and when I run bench update I get that error
I tried for 2 and 3 time in new erpnext but i get the same error

Have you tried

bench update --reset

1 Like