Showing posts with label Github. Show all posts
Showing posts with label Github. Show all posts

Tuesday, April 16, 2013

Basics on setting up Git and GitHub using Eclipse

Setting up Git user preference in eclipse:
- Select Window > Preferences > Team > Git > Configuration to set them up
- To add your user, use the user.name as key and your real name as value
- Repeat the procedure for your email address: user.email

To create a local Git repository:
- Right click on the project and go to Team > Share Project
- In the "Configure Git Repository" dialog box, selct the "Create" button to create a new repository
- Provide a Name for the project repository (could be same as the project-name itself). Click on Finish
- Click Finish in the original dialog box

To commit the whole project, folder or a single file:
- Right click on the resource to be committed and press commit
- In the Commit dialog box that opens, enter a sensible commit message. Choose the file/s to be committed
- Press "Commit" button to commit changes to the local repository. Press "Commit and Push" button to commit changes to the GitHub (or any permanent) repository
- You can also open the "Git Staging" view and take a look at all the "Unstaged Changes" area
- Drag and drop the files (to be committed to local repo.) to the "Staged Changes" area
- Type in a commit message in the "Commit Message" area. Press one of "Commit" or "Commit and Push" buttons to commit the file/s

To upload a project to GITHub repository:
- Open "Git repositories" view in eclipse
- Right click on the project (in Git repositories tab) to be uploaded to Git Hub and select the "Push" option
- In the dialog box that opens, enter the git hub URI of your repository. The Rest of the the entries would be filled up by eclipse itself. Click Next
- In Source Ref chose the master [branch] option from the drop down. Click the Add Spec button
- Click Next to press finish or press finish directly
- The project would get upload to GitHub. Check GitHub repository to ensure this has happened

Reference:
I followed this excellent article by Lars Vogel.
http://www.vogella.com/articles/EGit/article.html