簡體   English   中英

Eclipse創建git存儲庫故障

[英]Eclipse create git repository failure

對於我的一個項目,當我嘗試使用以下步驟創建一個git存儲庫時: select Team → Share Project → Git我會收到此錯誤:

在此輸入圖像描述

檢查Eclipse錯誤日志視圖會顯示以下異常:

org.eclipse.jgit.errors.NoWorkTreeException:Bare Repository在org.eclipse.egit.ui.internal的org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1235)既沒有工作樹,也沒有索引。 .haring.ExistingOrNewPage.fillTreeItemWithGitDirectory(ExistingOrNewPage.java:518)atg.eclipse.egit.ui.haternal.sharing.ExistingOrNewPage.createControl(ExistingOrNewPage.java:353)org.eclipse.jface.wizard.Wizard.createPageControls(向導) .java:174)org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:736)org.eclipse.jface.WizardDialog.setWizard(WizardDialog.java:1182)org.eclipse.jface。向導.WizardDialog.updateForPage(WizardDialog.java:1241)org.eclipse.jface.wizard.WizardDialog.access $ 4(WizardDialog.java:1238)org.eclipse.jface.wizard.WizardDialog $ 8.run(WizardDialog.java: 1227)org.eclipse中的org.eclipse.wt.cwt.BusyIndi​​cator.showWhile(BusyIndi​​cator.java:70)org.eclipse.jow.wizard.WizardDialog.showPage(WizardDialog.java:1225) .gam.internal.ui.wizards.ConfigureProjectWizardMainPage $ 2.doubleClick(ConfigureProjectWizardMainPage.java:156)org.eclipse.jface.viewers.StructuredViewer $ 1.run(StructuredViewer.java:845)org.eclipse.core.runtime.SafeRunner .run(SafeRunner.java:42)org.eclipse.ui.internal.JFaceUtil $ 1.run(JFaceUtil.java:49)org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)at org .eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:843)org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:1134)org.eclipse.jface.viewers.StructuredViewer $ 4.widgetDefaultSelected( StructuredViewer.java:1246)位於org.eclipse的org.eclipse.jhere.util.OpenStrategy.access $ 0(OpenStrategy.java:246)的org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:249)。位於org.eclipse.swt.widgets.Widget.s的org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)的jface.util.OpenStrategy $ 1.handleEvent(OpenStrategy.java:307) orE.eclipse上的org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)中的org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)的endEvent(Widget.java:1057) .gface.window.Window.runEventLoop(Window.java:826)atg.eclipse.jface.window.Window.open(Window.java:802)org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard.openWizard (ConfigureProjectWizard.java:224)org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard.shareProjects(ConfigureProjectWizard.java:124)at org.eclipse.team.internal.ui.actions.ConfigureProjectAction $ 1.run(ConfigureProjectAction。 java:39)atg.eclipse.team.internal.ui.actions.TeamAction $ 3.run(TeamAction.java:266)at org.eclipse.swt.custom.BusyIndi​​cator.showWhile(BusyIndi​​cator.java:70)at org。 eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:263)位於org.eclipse.team的org.eclipse.team.internal.ui.actions.ConfigureProjectAction.execute(ConfigureProjectAction.java:33)。 internal.ui.actions.TeamAction.run(TeamAc tion.java:515)org.eclipse.team.internal.ui.actions.TeamAction.runWithEvent(TeamAction.java:549)org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)at org位於org.eclipse.jface.action.ActionContributionItem.access $ 2(ActionContributionItem.java:501)的.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)org.eclipse.jface.action.ActionContributionItem $ 5.handleEvent (ActionContributionItem.java:411)org.eclipse中的org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)中的org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)。位於org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 9的org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)的swt.widgets.Display.runDeferredEvents(Display.java:4170) .run(PartRenderingEngine.java:1113)org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRe) nderingEngine.java:997)org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)org.eclipse.ui.internal.Workbench $ 5.run(Workbench.java:610)at org.eclipse.core.datab.observable.Realm.runWithDefault(Realm.java:332)位於org.eclipse.ui.PlatformUI.createAndRunWorkbench的org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) PlatformUI.java:150)org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)位於org.eclipse的org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)位於org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)的sun.reflect.NativeMethodAccessorImpl.invoke0(Native 方法)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:606)at at Org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)org.eclipse.equinox.launcher.Main.run( Main.java:1450)

我可以為其他項目設置git repo而沒有問題,如何“重置”這個項目的狀態,這樣我就可以成功設置git repo? 謝謝。

以下是創建項目的步驟,使用git管理它,並在eclipse中啟用git,
腳步:
0.在eclipse中創建一個項目,
1.在命令行中,轉到項目的根文件夾,調用: git init
2.在eclipse中,右鍵單擊項目 - >團隊 - >共享項目,選擇git,然后,
3.檢查選項“在項目的父文件夾中使用或創建存儲庫”,如果還沒有,
4.按“完成”,好的
5.正確的項目 - >團隊,現在你可以看到git操作,

OP Kai 評論

我認為這是由工作區設置中的一些小故障造成的:

  • 只是從工作區中刪除項目,
  • 將它移動到另一個目錄,
  • 將其導回(帶副本),

瞧,git repo現在神奇地被發現了。 -


如果它真的是一個簡單的倉庫,那么你需要將你的裸倉庫轉換為非裸倉庫 ,以便能夠檢查它,並在Eclipse中導入簽出的文件。

cd /path/to/yourRepo.git
cd ..
mkdir yourRepo
mv yourRepo.git yourRepo
cd yourRepo
git config --local --bool core.bare false
git reset HEAD -- .

只有在共享項目時提到的路徑中有(裸)repo時,才會顯示該錯誤消息。

以上答案對我來說不起作用。 我不得不打開git透視圖並添加我的本地存儲庫。 然后刪除包資源管理器中的項目,以及RMB導入 - >“來自git的項目”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM