本文介绍了如何添加eclipse项目到现有的git仓库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Eclipse中有一个现有的项目,我想添加到我的团队的github回购中。 github回购现在是空的。将此项目添加到我们的github回购中的最佳方式是什么?我正在考虑把我们的仓库放到workspace文件夹(父项目所在的项目)中,然后使用添加项目文件git add / code>,然后推送更改。这会工作,还是有更好的方法来做到这一点(也许与EGIT)?

解决方案

你必须添加一个远程到项目,然后推送它。



例如,您可以(从项目目录中)

  git init#如果您还没有
git remote add origin ssh://git@github.com:.....
git push -u origin master

应该有一种方法可以从eclipse插件中做到这一点,但我发现它很容易从命令行执行。:)

顺便说一下,请记住将所有IDE特定的文件添加到 .gitignore ,避免将垃圾推向世界:它们通常是 .project , .classpath 和目录如 bin / * , .settings / * ...


I already have an existing project in Eclipse that I want to add to my team's github repo. The github repo is empty right now. What's the best way to add this project to our github repo? I was thinking of git cloneing our repo into the workspace folder (parent to the project in question) and then adding the project files using git add, then pushing the changes. Would that work, or is there a better way to do this (perhaps with EGit)?

解决方案

You have to add a remote to the project, and then push to it.

For example, you can do (from inside the project directory)

git init # if you haven't already
git remote add origin ssh://git@github.com:.....
git push -u origin master

there should be a way to do that from the eclipse plugin too, but I find it easiear to do it from the command line.. :)

By the way, remember to add all the IDE-specific files to .gitignore, to avoid pushing garbage to the world: they usually are .project, .classpath and directories like bin/*,.settings/* ...

这篇关于如何添加eclipse项目到现有的git仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 17:03