无法将文件添加到git存储库,但可以更改/提交 [英] can't add file to git repository but can change / commit

查看:138
本文介绍了无法将文件添加到git存储库,但可以更改/提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是错误:

git add .emacs
error: insufficient permission for adding an object to repository database .git/objects

error: .emacs: failed to insert into database
error: unable to index file .emacs
fatal: adding files failed

我该如何解决?怎么了?

how can I fix it ? what's wrong with it ?

推荐答案

error: insufficient permission for adding an object to repository database .git/objects

那是你的问题.由于某种原因或其他原因,Git无法写入.git/objects-通常这意味着它是由另一个用户拥有的,并且没有适当的权限.

That is your problem. For some reason or another, Git is having trouble writing to .git/objects - typically this means it is owned by another user and doesn't have the proper permissions.

通过运行ls -l .git/objects尝试查看文件夹当前具有的权限.然后,可以根据需要chmodchown(或两者).

Try seeing what permissions the folder currently has by running ls -l .git/objects. Then, you can chmod or chown (or both) as necessary.

这篇关于无法将文件添加到git存储库,但可以更改/提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆