Git Working Directory to Eclipse Workspace

12,535

This blog post (from Lucas Piva Rocha Corrêa) details the step you need to follow to share your local git project on GitHub;

  • that includes the "Team Share" you found
  • but it also mentions the ssh settings you need to get right in order to be able to push to an https GitHub address.

Configuring Eclipse

  • Go to Windows -> Preferences and filter SSH. Select SSH2 on the left tab (should be under General -> Network connections).
  • Check that SSH2 home is set to /home/<yourusername>/.ssh and id_rsa is in Private Keys.
  • On Key Management tab, click on Load Existing Key... and select your id_rsa (private) key under ~/.ssh/id_rsa. If your key has a non-empty passphrase, eclipse will not be able to load it, even if you provide the correct password.
  • Now, just save it in the same location you loaded it from, confirm empty passphrase, overwrite it, apply and click ok.

Pushing your project to your github repo

Final step is to push your project to your remote repository on github.

  • Finally, select the project you want to push to your created repository, right click it, go to Team -> Share Project... and select git.
  • Select your project, click on Create Repository and Finish. Now you should be able to commit and update changes to your local git repository.
  • To push it to your remote GitHub repo, right click your project, select Team -> Remote -> Push...
  • Fill the URI with your project SSH address, which is shown when you enter your repository page on GitHub.
  • Select ssh protocol, user is git and empty password.
  • Cross your fingers, hit next. If it doesn't work for some reason at this point, try restarting Eclipse (it worked for me after restart).
  • Select Source Ref and Destination Ref (basically the branch), click on Add Spec and Finish on the next screen.
  • Hopefully everything goes well.
Share:
12,535
totalcruise
Author by

totalcruise

Updated on July 01, 2022

Comments

  • totalcruise
    totalcruise almost 2 years

    I have been building my maven project(s) within my spring tool suite work space and have now decided that I need to get busy with some version control.

    I have gone for GIT and have used the command line client to produce a local repository.

    So, I have a local repo - which is ready to implements version control and a workspace with a load of files.

    I am using the GIT plugin for Eclipse. See the image below.

    enter image description here

    How am I able to somehow synchronise my workspace with my git working directory so I can start to stage and commit indexes to Github?

    Many thanks

    //** EDIT **//

    Okay - having found this blog

    I realized it is a simple project->team->share project option in the Eclipse Project Context Menu.

    Thanks

  • Nicolas Lauquin
    Nicolas Lauquin about 11 years
    On eclipse 4.2.2 and with eGit 2.2 on OSX, I followed this instruction of saving an id_rsa_eclipse without passphrase from eclipse. When I try to do a team synchronize on my repo, I got a popup asking me "Provide information for ssh://[email protected]:22, passphrase for ~/.ssh/id_rsa_eclipse. The empty nor the original password are working. And it keep asking. Any idea ?