解决cofs在colinux下使用git的权限问题

来源:互联网 发布:1000base t以太网端口 编辑:程序博客网 时间:2024/05/21 15:44

问题


在colinux下直接挂载cofs的目录下,建立git库上不能添加文件,估计也不能clone远程库。

 

error: file write error (Operation not permitted)
fatal: unable to write sha1 file

 

解决方式


mount -t cofs cofs0 -o uid=myid, gid=mid,noattrib,dmask=0775,fmask=0664 /mnt/win

 

 

 

过程分析

 


挂载 mount -t cofs cofs0 -o uid=myid, gid=mid /mnt/win (解决了mount之后/mnt/win只能由root访问的权限问题)

 

git init OK

git add xxx 则出错:

 

通过查看.git/objects下的文件发现,增加文件会增加一个目录,如94/xxx 就是sha1文件名,这个文件是只读的。

也就是说git自己创建了一个只读文件,然后发现写不进内容,这是何苦,谁做的傻事?

增加noattrib选项后,默认文件的属性都是rwx,git使用没问题,但是没有必要都是x,用dmask=0775,fmask=0664就好了