无法使用 Eclipse EGit 将文件添加到我的存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4451773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:30:27  来源:igfitidea点击:

Can't add files to my repository with Eclipse EGit

eclipseegit

提问by Rene Terstegen

I use Eclipse (Helios) with PDT and EGit. I have a project without versioning, so I created a git repository for it by doing:

我将 Eclipse (Helios) 与 PDT 和 EGit 一起使用。我有一个没有版本控制的项目,所以我通过执行以下操作为它创建了一个 git 存储库:

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:

eclipse给出的错误是:

Caused by: org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: Z:\eage_layout\.git\objects\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.

我正在运行的代码位于 CentOs 上运行的虚拟机上。我正在 Windows 机器上工作并使用 samba 共享来访问虚拟机上的代码。我已将 .git 目录上的文件系统权限设置为 777,但它仍然不起作用。

回答by chacac

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.

我有一个类似的问题,其中 egit 添加一些文件失败,但没有添加其他文件。经过许多时间的浪费,我终于找到了解决我的问题的方法。添加 core.autocrlf=false 解决了问题。

回答by VonC

It could be similar to this thread:

它可能类似于这个线程

Figured out the problem -- it was to do with Egit, not texlipse.
Turned out that there are issues with multiple projects in a work place, and I had some dead ones I'd removed from the workspace view but whose directories were still there.
Moving these folders out of the workspace seems to have fixed the issue.

找出问题所在——它与 Egit 相关,而不是 texlipse。
结果发现工作场所中的多个项目存在问题,我从工作区视图中删除了一些死掉的项目,但它们的目录仍然存在。
将这些文件夹移出工作区似乎解决了这个问题。

Did you try with a workspace with only one project?

您是否尝试过只有一个项目的工作区?

回答by zaza

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.

错误日志视图中是否有异常?您使用的是哪个版本的 EGit?我知道这不是值得推荐的东西,但我生活在前沿并使用n-builds。它们非常稳定,并且比最新的稳定版本提供了更多的选择。

回答by sunyata

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

也许这与 .git 以外的其他文件/目录的权限有关,我在 debian 中从 root 命令行设置 git 项目后遇到了同样的问题,但是在从用户帐户命令行重做整个事情之后在 eclipse 中没有问题了

Kind Regards, Tord

亲切的问候,托德

回答by Ashish gupta

its a problem with your folder permission please give the write permission then try . i have a same problem but now resolved.

您的文件夹权限有问题,请给予写入权限,然后尝试。我有同样的问题,但现在解决了。