Push eclipse project to GitHub with EGit

Viewed 158974

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?

5 Answers

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.

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.

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 git@github.com 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.

Related