Reputation: 1363
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.
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
Upvotes: 7
Views: 13028
Reputation: 1323553
This blog post (from Lucas Piva Rocha Corrêa) details the step you need to follow to share your local git project on GitHub;
- Go to
Windows -> Preferences
and filter SSH. SelectSSH2
on the left tab (should be under General -> Network connections).- Check that
SSH2
home is set to/home/<yourusername>/.ssh
andid_rsa
is in Private Keys.- On
Key Management
tab, click onLoad Existing Key
... and select yourid_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.
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 selectgit
.- 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 isgit
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.
Upvotes: 4