Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add current Eclipse project to git with EGit?

Tags:

git

eclipse

egit

I have GAE project in my Eclipse and I want to add it to my local git repo, how can I do that?

like image 367
newbie Avatar asked May 14 '11 10:05

newbie


People also ask

How do I add an existing Eclipse project to Git?

With your project open in Eclipse, right-click the project name in Project Explorer and select Team, Share Project... Select Git and select Next. Select Create... from the Configure Git Repository window and choose a folder for your local Git repo. Select Finish.

How do I upload an existing Eclipse project to GitHub?

Step 1: Open Eclipse IDE and right-click on the project you want to push and go to Team->share project. Step 2: It will add the project to the given repository as shown below: Step 3: Again right-click on the project and go to Team->commit.


1 Answers

Since creating a Git repo within a GAE project is possible through command line, it is possible through Egit:
Follow that Egit tutorial:

For a new repo:

Right click your project, select Team -> Share -> Git.
Select the proposed line and press "Create repository". Press finish

egit repo creation dialog

Create the file ".gitignore" in your project with the following content.
All files / directories which apply to the pattern described in this file will be ignored

But you can also add it to an existing local repo by:

  • making a special branch for your project in your local repo (with just the .gitignore file in it)
  • clone it where your current project is
  • add all your current project files in it
  • import said Git repo into your workspace: See 4.2 Clone existing project.

informatik01 adds in the comment a link to a short article describing how to do it using the command line:
Adding Eclipse Project to Git

cd ~/workspace/my-project
git init .
like image 59
VonC Avatar answered Nov 03 '22 05:11

VonC