如何添加eclipse项目到现有的git仓库? [英] How to add eclipse project to existing git repo?
问题描述
我已经在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 clone
ing 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仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!