无法使用 Eclipse EGit 将文件添加到我的存储库
我将 Eclipse (Helios) 与 PDT 和 EGit 一起使用。我有一个没有版本控制的项目,所以我通过以下方式为其创建了一个 git 存储库:
Team -> Share Project
当我尝试将项目的文件添加到存储库时:
Team -> Add
我得到一个异常:
Failed to add resource to index
Failed to add resource to index
Exception caught during execution of add command
当我在命令行上手动添加文件时,一切都是工作正常。
有什么想法吗?
编辑:
eclipse 给出的错误是:
Caused by: org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: Z:\eage_layout\.git\objects\60\f30dd232bd6ddaeb198fb11400c2613a072189
at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:100) at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:177)
我正在运行的代码位于 CentOs 上运行的虚拟机上。我正在 Windows 计算机上工作,并使用 samba 共享来访问虚拟机上的代码。我已将 .git 目录的文件系统权限设置为 777,但它仍然不起作用。
I use Eclipse (Helios) with PDT and EGit. I have a project without versioning, so I created a git repository for it by doing:
Team -> Share Project
When I try to add the files of my project to the repository:
Team -> Add
I get an exception:
Failed to add resource to index
Failed to add resource to index
Exception caught during execution of add command
When I add the files manually on the command line, everything is working fine.
Any ideas?
EDIT:
The error eclipse gives is:
Caused by: org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: Z:\eage_layout\.git\objects\60\f30dd232bd6ddaeb198fb11400c2613a072189
at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:100) at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:177)
The code I'm running is located on a virtual machine running on CentOs. I'm working on a windows machine and using a samba share to get access to the code on the virtual machine. I've put the filesystem permissions on my .git directory to 777, but still it does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我遇到了类似的问题,egit 无法添加一些文件,但无法添加其他文件。经过许多浪费时间后,我终于找到了解决我的问题的方法。添加 core.autocrlf=false 解决了问题。
I had a similar problem, where egit was failing on adding some files but not others. After many wasted hours I finally found the solution to my issue. Adding core.autocrlf=false solved the problem.
它可能类似于此线程:
您是否尝试过使用只有一个项目的工作区?
It could be similar to this thread:
Did you try with a workspace with only one project?
错误日志视图中是否有异常?您使用的是哪个版本的 Egit?我知道这不是值得推荐的东西,但我生活在最前沿并使用 n-builds< /a>.它们非常稳定,并且比最新的稳定版本提供更多的选择。
Is there an exception in the Error Log view? What version of EGit are you on? I know it's not something to be recommended but I'm living on the bleeding edge and use n-builds. They are quite stable and give far more options than the latest stable build.
也许这与 .git 之外的其他文件/目录的权限有关,在 debian 中从根命令行设置 git 项目后,我遇到了同样的问题,但在从用户帐户命令行重做整个事情之后在日食中不再有问题
亲切的问候,托德
Maybe this has something to do with permissions for other files/directories than .git, i had the same problem after setting up a git project from a root command line in debian, but after redoing the whole thing with from a user account command line there was no problem in eclipse anymore
Kind Regards, Tord
您的文件夹权限有问题,请授予写入权限,然后尝试。我有同样的问题,但现在已经解决了。
its a problem with your folder permission please give the write permission then try . i have a same problem but now resolved.