简体   繁体   中英

Push eclipse project to GitHub with EGit

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?

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. . 在此处输入图片说明 Then you can push to github.

NB: 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.

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

I have the same issue and solved it by reading this post, while solving it, I hitted a problem: auth failed .

And I finally solved it by using a ssh key way to authorize myself. I found the EGit offical guide very useful and I configured the ssh way successfully by refer to the Eclipse SSH Configuration section in the link provided.

Hope it helps.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM