Bench update: error: cannot open .git/FETCH_HEAD: Permission denied

Hi all,
I tried update my bench but the following error is occured:

/home/frappe/frappe-bench# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
error: cannot open .git/FETCH_HEAD: Permission denied

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
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 “/home/frappe/bench-repo/bench/commands/update.py”, line 35, in update
update_bench()
File “/home/frappe/bench-repo/bench/utils.py”, line 246, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/bench-repo/bench/utils.py”, line 130, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull


I also tried to git pull all the apps in my bench: frappe & erpnext & .bench folder, and the all run fine!
any suggestion plz?
Thanks
Maysaa

seems like the permission issue, please check the permissions to a bench directory

Hi @MaysaaSafadi,

try Sudo bench update

Thanks

I checked it also and it have all the permissions

I tried it also; the same error

Share the output of frappe & erpnext repos using the following command
git remote -v

Thanks

That is:
/home/frappe/frappe-bench/apps/frappe# git remote -v
upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript (fetch)
upstream GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript (push)

/home/frappe/frappe-bench/apps/erpnext# git remote -v
upstream GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) (fetch)
upstream GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) (push)

I’m having the same error .

but my git remote -v

output is

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

error: cannot open .git/FETCH_HEAD: Permission denied

cd /apps/custom_app/

/apps/custom_app/ sudo chown -R frappe .git/