In this tutorial, let us see how to share any eclipse project to Git repository (github.com) and also we will see how to to check out the github repository project in Eclipse.
In this example, let us share the project named JavaRestService to git and vice versa.
PART I) Steps to share eclipse project to Github repository.
1. Create a new local git repository or use an existing one and share the project. For creating local git repository, right click on the project and select Team->Share Project->Git
2. Select any local folder (in this example, C:\GitRepos\JavaRestService) as Repository to store the project and click on Finish
Please ensure that the folder C:\GitRepos\JavaRestService is created
3. Click on Next and Finish.
4. Commit the project. For committing the project, right click on the project and select Team->Commit
Select all the files to be committed and Click on Commit.
Now the project is committed to the local git repository.
5. Now Push the local git repository to github.com. Right click on the project and Select Team->Remote->Push
Assume that you have created new remote repository (In our example, JavaRestService) in github.com. If you have not created, new remote repository, then follow the steps given in the Part II.
6. Paste the remote git repository URL in the URL input box and give github.com userid and password then select next. In our example, we are using https protocol.
7. Select source and destination reference (refs/heads/master) as given in the image and click on Add Spec then Next and Finish
8. Confirm the push
now you have successfully pushed the local repository to remote github.com
Part II) Creating new remote repository in github.com
- Login to github.com
2. Click on Create Repository and enter new repository name (In our example: JavaRestService)
3. Confirm the button Create Repository
Now the remote empty repository is created and the URL for the repository is
PART III) Checking out the github shared project in Eclipse
- Right click on Eclipse work space and select Import->Import->Git->Projects from Git
- Select Clone URI and Next
3. Paste the github.com shared repository url in the URI input box(In our example, https://github.com/vkjegan/JavaRestService), fill the user id and password then Next
4. Select Branch and Next
5. Select local destination directory where the local git repository needs to be created
6. Select Next
7. Again Select Next and Finish. Now the remote git project is imported and github repository is created locally.