Push eclipse project to GitHub with EGit

156,017

Solution 1

The key lies in when you create the project in eclipse.

First step, you create the Java project in eclipse. Right click on the project and choose Team > Share>Git.

In the Configure Git Repository dialog, ensure that you select the option to create the Repository in the parent folder of the project.. enter image description here Then you can push to github.

N.B: Eclipse will give you a warning about putting git repositories in your workspace. So when you create your project, set your project directory outside the default workspace.

Solution 2

Simple Steps:

-Open Eclipse.

  • Select Project which you want to push on github->rightclick.
  • select Team->share Project->Git->Create repository->finish.(it will ask to login in Git account(popup).
  • Right click again to Project->Team->commit. you are done

Solution 3

I use these Simple Steps when I already have committed locally a new project:

  1. Open github.com and sign in and create a new repository.
  2. Copy URL of the new repository.
  3. Open Eclipse.
  4. Select Project which you want to push on github->rightclick.
  5. select Team->share Project->Git-> "push branch '' ...".
  6. Follow the wizard until it finishes.
Share:
156,017

Related videos on Youtube

salvador
Author by

salvador

Updated on July 09, 2022

Comments

  • salvador
    salvador almost 2 years

    I am successfully pushing my project to GitHub using EGit. My repository is called HelloWorld. My project in eclipse is also called HelloWorld. My problem is when i push the project it is upload the project under the folder HelloWorld. So the result is the repository HelloWorld then the folder HelloWorld and the the src folder. To be more understandable here is the link of the project. I want under the repository HelloWorld to have the src folder. How can I achieve that?

    • Ashok Pandian
      Ashok Pandian over 7 years
      @KumarAbishek, To get URI, go to your GitHub account, open the corresponding repository and copy the current page url. Once you paste the url in URI field, other fields such as Host, Repository path and Protocol will be auto populated.
  • 2Big2BeSmall
    2Big2BeSmall over 8 years
    Hey, i have created a project and shared it with Team > Share>Git. but how can i add new class which added after share with git? how do i update the project on git with this new class ?
  • greenkode
    greenkode over 8 years
    I would suggest you spend some time familiarizing yourself with Git. Here's the Egit User guide, it contains everything you need to know when using Egit from within eclipse. wiki.eclipse.org/EGit/User_Guide
  • TmTron
    TmTron over 7 years
  • Kumar Abhishek
    Kumar Abhishek over 7 years
    Satya, Please also mention how to provide URI, Host,Repository path. the one that you are suggesting only works when git project is already configured.
  • Al G Johnston
    Al G Johnston about 4 years
    Does this take care of dependencies on other projects in the workspace? What would be the best way to handle dependencies? I am trying to get my stuff on Maven to make it easier, but it is slow.