git push error:remote:error:无法打开.git / FETCH_HEAD:权限被拒绝

时间:2015-12-03 09:31:52

标签: git

on server:  
    /git             755 git:git  
    /git/gitdemo.git 755 git:git  

on local(mac mini):  
    /opt/webroot                775 nobody:nobody  
    /opt/webroot/gitdemo        777 user:nobody
    /opt/webroot/gitdemo/.git/* 777 user:nobody

>git clone git@server:/git/gitdemo.git  gitdemo

我使用ssh无需密码登录 没关系:

>git pull origin master

但错误:

>git push origin master

完整的错误信息:

>git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 233 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: cannot open .git/FETCH_HEAD: Permission denied
remote:
remote: error: unable to update .git/info/refs+
remote: error: cannot open .git/objects/info/packs+
To git@***/git/gitdemo.git
   9fef5a8..f531910  master -> master

但它成功推送,虽然它报告了权限错误。

chmod,chown不起作用。 需要帮助,请。

1 个答案:

答案 0 :(得分:0)

检查以下文件:

/opt/webroot/gitdemo/.git/FETCH_HEAD
/opt/webroot/gitdemo/.git/info/refs
/opt/webroot/gitdemo/.git/objects/info/packs

它们必须由mac mini上的'user'拥有,或者至少'user'应该对这些文件(以及整个.git /目录)具有写权限