How to put your code at github

You just developed a project and want to share it with your peers, or maybe just want to work on the same project from multiple PCs. And for doing so, you want to up your code at github.com. This post is about how to do this work (starting from the assumption your project is developed with eclipse). It is not my intent to describe here the concepts behind the GIT technology.

I am describing how to use eGit in Eclipse Mars vs.1. Now, first thing you need to do is to go to Help -> Eclipse Marketplace and install the EGIT plugin,

Eclipse Marketplace, eGit plugin
Eclipse Marketplace, eGit plugin

A full tutorial about eGit can be found at http://wiki.eclipse.org/EGit/User_Guide.

Login into github.com account and create a repository for your new project. For this tutorial purpose I created on my github.com account a repository called JavaCertifications.

Go back to eclipse and open the Git Repositories View (). Choose Clone a Git Repository and fill the fields like:

Eclipse - Clone a GIT Repository

Click Next. In the next page, click Next also. The repository will be cloned on your local system. I recommend to place your local git repository outside of the eclipse workspace. Doing so, you will separate your repository from any files which eclipse will create.

Github.com repository. Clone to local repository

Click Finish. In the Git Repositories view of eclipse you will see the newly added repository:

Git repository in Eclipse

Go to Package Explorer view in eclipse, right click on your project and choose Team -> Share Project. Choose your repository and click Finish.

Configure your GIT repository in Eclipse

Again, right click on your project, choose Team -> Commit. The Git Staging will open:

eGit in Eclipse - Commit and Push

Enter a commit message and click Commit and Push. Now, your code is at github.com. Go and check it.

Note: Clicking Commit will commit the code to your local repository only.

Spread the love

Leave a Reply