git 如何使用 GitHub 设置 Eclipse/EGit?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5723957/
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
How do I set up Eclipse/EGit with GitHub?
提问by john
I've never used Git before and would like to learn.
我以前从未使用过 Git,想学习。
I have a private repository with GitHub.
我有一个带有 GitHub 的私有存储库。
I've installed the EGit plugin for Eclipse.
我已经为 Eclipse 安装了 EGit 插件。
I have a workspace where I do my work, generally: ~/Documents/workspace
.
我有一个工作区供我工作,通常是:~/Documents/workspace
.
I am able to add my GitHub repository and download it, but in doing so it creates ~/MyRepository
.
我可以添加我的 GitHub 存储库并下载它,但这样做会创建~/MyRepository
.
When I create a project, do I need to point it to ~/MyRepository
?
创建项目时,是否需要将其指向~/MyRepository
?
Also, how come when I make an edit and I say push to upstream it says up to date?
另外,为什么当我进行编辑时我说推送到上游它说是最新的?
采纳答案by Mohamed Mansour
Make sure your refs for pushing are correct. This tutorial is pretty great, right from the documentation:
确保你的推送参考是正确的。本教程非常棒,直接来自文档:
http://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial
http://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial
You can clone directly from GitHub, you choose where you clone that repository. And when you import that repository to Eclipse, you choose what refspec to push into upstream.
您可以直接从 GitHub 克隆,您可以选择克隆该存储库的位置。当您将该存储库导入 Eclipse 时,您可以选择要推送到上游的 refspec。
Click on the Git Repository workspace view, and make sure your remote refs are valid. Make sure you are pointing to the right local branch and pushing to the correct remote branch.
单击 Git Repository 工作区视图,并确保您的远程引用有效。确保您指向正确的本地分支并推送到正确的远程分支。
回答by thSoft
Install Mylyn connector for GitHub from this update site, it provides great integration: you can directly import your repositories using Import > Projects from Git > GitHub. You can set the default repository folder in Preferences > Git.
从这个更新站点为 GitHub 安装 Mylyn 连接器,它提供了很好的集成:您可以使用 Import > Projects from Git > GitHub 直接导入您的存储库。您可以在首选项 > Git 中设置默认存储库文件夹。
回答by Veda Gaddam
In Eclipse, go to Help -> Install New Software -> Add -> Name: any name like egit; Location: http://download.eclipse.org/egit/updates-> Okay. Now Search for egit in Work with and select all the check boxes and press Next till finish.
在 Eclipse 中,转到 Help -> Install New Software -> Add -> Name:任何名称,如 egit;位置:http: //download.eclipse.org/egit/updates-> 好的。现在在 Work with 中搜索 egit 并选中所有复选框,然后按 Next 直到完成。
File -> Import -> search Git and select "Projects from Git" -> Clone URI. In the URI, paste the HTTPS URL of the repository (the one with .git extension). -> Next ->It will show all the branches "Next" -> Local Destination "Next" -> "Import as a general project" -> Next till finish.
文件 -> 导入 -> 搜索 Git 并选择“来自 Git 的项目” -> 克隆 URI。在 URI 中,粘贴存储库的 HTTPS URL(带有 .git 扩展名的 URL)。-> Next -> 它将显示所有分支“Next” -> Local Destination “Next” -> “Import as a general project” -> Next 直到完成。
You can refer to this Youtube tutorial: https://www.youtube.com/watch?v=ptK9-CNms98
你可以参考这个Youtube教程:https: //www.youtube.com/watch?v=ptK9-CNms98