salvador
salvador

Reputation: 1089

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?

Upvotes: 21

Views: 163028

Answers (5)

S J
S J

Reputation: 1

If you ever face an authentication issue in any IDE - Eclipse, sts, etc. Simply while creating a remote repository select ssh protocol it won't ask you any username or password. (But will create a file ed25519 on your system which will be having an ssh key). Now you can push or do other activities using IDE without having any authentication issues.

In case of Git bash use command $ssh-keygen (ask for file give proper file path) suppose you give name as y.pub. Run the command $cat y.pub copy the ssh key(starting something as ssh-rsa...) and paste in GitHub(opened in browser your remote repository) now type command $ssh -t [email protected] If you get an error while using the above command changed the command to $ssh-keygen -t ed25519 -c "your userid" then open the file by using $cat ed25519.pub file copy the ssh key & paste into Github. Now you are authenticated to perform the various operations. The other option if you want to use https only is to generate pat(personal access token).go to github-go to settings-go to developer settings-go to personal access token.If you aready had token delete it else click on generate new token.Give anything in note.Click on repo (you can select multiple options too) click generate token.Copy the token and now in your ide instead of password use the token.I hope it will solve your problem.

Upvotes: 0

Shadyar
Shadyar

Reputation: 845

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.

Upvotes: 1

ZhaoGang
ZhaoGang

Reputation: 4915

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.

Upvotes: 0

Satya Tiwari
Satya Tiwari

Reputation: 103

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

Upvotes: 7

greenkode
greenkode

Reputation: 3996

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.

Upvotes: 34

Related Questions