在EGit推送期间拒绝访问:如何设置对exe而不是文件夹的引用?

时间:2015-04-18 09:29:44

标签: eclipse git egit

我在Eclipse中使用EGit进行Gradle构建。由于Gradle配置在克隆到其他文件夹时中断,因此我只选择已填充的文件夹来创建新的存储库。当推送到远程时,我收到此错误:

Transport Error: Cannot get remote repository refs.
Cannot run program "C:\Program Files (x86)\Git\bin":
    CreateProcess error=5, Access is denied

最有可能的是,引用应该是git.exe而不是它的路径,但是我还没有找到在Eclipse中配置它的方法。错误级联:

org.eclipse.jgit.api.errors.TransportException: Cannot run program "C:\Program Files (x86)\Git\bin": CreateProcess error=5, Access is denied
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:223)
at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:159)
at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:99)
at org.eclipse.egit.ui.internal.components.RefSpecPage$3.run(RefSpecPage.java:250)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Caused by: org.eclipse.jgit.errors.TransportException: Cannot run program "C:\Program Files (x86)\Git\bin": CreateProcess error=5, Access is denied
at org.eclipse.jgit.transport.TransportGitSsh$ExtSession.exec(TransportGitSsh.java:245)
at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:202)
... 4 more

Caused by: java.io.IOException: Cannot run program "C:\Program Files (x86)\Git\bin": CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at org.eclipse.jgit.transport.TransportGitSsh$ExtSession.exec(TransportGitSsh.java:243)
... 7 more

Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 9 more

以前我有这个警告,但不知怎的,我能够解决它:

Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level...

我已经检查过我对Git二进制文件的读/写访问权限并尝试以管理员身份运行Eclipse。根据{{​​3}},团队&gt; Git&gt;配置/系统设置路径应设置为路径&#34; C:\ Program Files(x86)\ Git&#34;。

如何设置对git.exe的引用而不是文件夹?


修改

Eclipse中也有错误:

FrameworkEvent ERROR

org.osgi.framework.BundleException: Could not resolve module: org.eclipse.egit.ui [117]
  Another singleton bundle selected: osgi.identity; osgi.identity="org.eclipse.egit.ui"; type="osgi.bundle"; version:Version="3.7.0.201502260915-r"; singleton:="true"

at org.eclipse.osgi.container.Module.start(Module.java:434)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

尝试过的解决方案:

  1. 擦除路径并将其设置为最小Eclipse依赖项,同时包含Git路径:C:\ ProgramData \ Oracle \ Java \ javapath; C:\ Git \ bin

  2. 我的规格

    Intel Core i7-3635QM CPU @ 2.40 GHz-12 GB RAM

    Windows 8.1(64位)

    Eclipse Luna(build 4.4.2.M20150204-1700)

    JAVA v 1.8.0_25

    BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
    Framework arguments:  -product org.eclipse.epp.package.java.product
    Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product
    org.eclipse.epp.package.java.product
    

1 个答案:

答案 0 :(得分:1)

Team>Git>Configuration/System应该是一个文件夹(对于 system wide configuration )。

如本主题所述:

  

FS_Win32.java中,JGit尝试通过在bash中运行命令“which git”来查找本机git。
  如果未安装本机git或者PATH上没有bash或git,那么此命令将失败。 JGit记录一个错误,留下这个尝试查找本机git失败的痕迹,但无论如何都会正常工作。

     

JGit尝试查找本机git,以便找到系统范围的git配置,该配置位于相对于本机git安装的路径中。
  如果找不到本机git安装,JGit无法找到这个系统范围的git配置,因此会忽略它。

尝试以简单的路径解压缩Git for Windows,然后将其添加到%PATH%(首先进行测试)。
试试:


关于框架错误:

org.osgi.framework.BundleException: Could not resolve module: org.eclipse.egit.ui [117]
  Another singleton bundle selected: osgi.identity; osgi.identity="org.eclipse.egit.ui"; type="osgi.bundle"; version:Version="3.7.0.201502260915-r"; singleton:="true"

Egit is installed (came with Juno), but does not show at all”的回答提到:

  

使用-clean命令行选项启动eclipse可以解决我的问题。