error: cannot open .git/FETCH_ Head: permission denied resolved

Error in Git pull code:
error: cannot open .git/FETCH_HEAD: Permission denied
The reason:
The current logged in user does not have permission to modify the directory.
Solutions:
Modify the current directory permissions
1. Whoami view the current logged in user

xxx$ whoami

Assume the above query login account as: Zhangsan
2. PWD view current directory

xxx:$ pwd

Suppose the query result of the above directory is: /Users/work
3. Modify permissions for Sudo Chown

xxx$ sudo chown -R zhangsan:admin /Users/work

Sudo Chow-r Current user: Admin Current directory


Read More: