eclipse - Git 工作目录到 Eclipse 工作区

标签 eclipse git github egit

我一直在我的 spring 工具套件工作空间中构建我的 maven 项目,现在我决定我需要忙于一些版本控制。

我选择了 GIT,并使用命令行客户端生成本地存储库。

因此,我有一个本地存储库 - 已准备好实现版本控制和一个包含大量文件的工作区。

我正在为 Eclipse 使用 GIT 插件。请参见下图。

enter image description here

我如何才能以某种方式将我的工作区与我的 git 工作目录同步,以便我可以开始暂存索引并将索引提交到 Github?

非常感谢

//** 编辑 **//

好的 - 找到了 this博客

我意识到这是一个简单的项目->团队->在 Eclipse 项目上下文菜单中共享项目选项。

谢谢

最佳答案

blog post (来自 Lucas Piva Rocha Corrêa )详细介绍了在 GitHub 上共享本地 git 项目所需遵循的步骤;

  • 包括您找到的“Team Share”
  • 但它也提到了您需要正确设置 ssh 才能推送到 https GitHub 地址。

配置 Eclipse

  • Go to Windows -> Preferences and filter SSH. Select SSH2 on the left tab (should be under General -> Network connections).
  • Check that SSH2 home is set to /home/<yourusername>/.ssh and id_rsa is in Private Keys.
  • On Key Management tab, click on Load Existing Key... and select your id_rsa (private) key under ~/.ssh/id_rsa. If your key has a non-empty passphrase, eclipse will not be able to load it, even if you provide the correct password.
  • Now, just save it in the same location you loaded it from, confirm empty passphrase, overwrite it, apply and click ok.

将你的项目推送到你的github repo

Final step is to push your project to your remote repository on github.

  • Finally, select the project you want to push to your created repository, right click it, go to Team -> Share Project... and select git.
  • Select your project, click on Create Repository and Finish. Now you should be able to commit and update changes to your local git repository.
  • To push it to your remote GitHub repo, right click your project, select Team -> Remote -> Push...
  • Fill the URI with your project SSH address, which is shown when you enter your repository page on GitHub.
  • Select ssh protocol, user is git and empty password.
  • Cross your fingers, hit next. If it doesn't work for some reason at this point, try restarting Eclipse (it worked for me after restart).
  • Select Source Ref and Destination Ref (basically the branch), click on Add Spec and Finish on the next screen.
  • Hopefully everything goes well.

关于eclipse - Git 工作目录到 Eclipse 工作区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8953231/

相关文章:

java - eclipse设置自动重命名类文件

Git fetch 卡在 git-upload-pack 上

php - 使用 git 和 php 进行开发(网络开发)

git - 使用 github 托管公共(public) git 存储库,同时确保敏感数据文件不被跟踪

r - 使用install_github时出错: 'exdir' does not exist

java - 使用 System.getProperty() 获取 @CucumberOptions 标签属性

java - 使用 AsyncTask 在一个布局上加载大量图像?

java - 在 Mac 上运行 Java 应用程序

linux - 使用 git am 打补丁

github - Github 或 GItLab 网站上是否提供用于远程存储库的终端?