How to Solve Error: cannot open .Git/fetch_HEAD: Permission denied

When using gitoite to manage git library, an error is reported when using the administrator account to perform git pull operation on gitolite admin warehouse

[drpeng@srvser gitolite-admin]$ git pull
error: cannot open .git/FETCH_HEAD: Permission denied

It literally means . Git/fetch_Head this file does not have permission. The permission to enter the. Git folder and view this file is really wrong. That’s a good solution

[drpeng@srvser gitolite-admin]$ cd .git
[drpeng@srvser .git]$ ll -h FETCH_HEAD
Totally 48K
**-rw-r--r--   1 root   root      0 Sep   7 2016 FETCH_HEAD**
[drpeng@srvser .git]$ exit
logout
[root@srvser git]# cd /home/drpeng/git-13/gitolite-admin/.git
[root@srvser .git]# chown -R drpeng.drpeng FETCH_HEAD
[root@srvser .git]# su - drpeng
[root@srvser git]# cd /home/drpeng/git-13/gitolite-admin/
[drpeng@srvser git-13]$ cd gitolite-admin/
[drpeng@srvser gitolite-admin]$ git pull
remote: Counting objects: 509, done.
remote: Compressing objects: 100% (404/404), done.
remote: Total 499 (delta 125), reused 0 (delta 0)
Receiving objects: 100% (499/499), 53.32 KiB, done.
Resolving deltas: 100% (125/125), done.

Above, the problem is solved~

Read More: