Wednesday, 27 February 2013

Setting up STS for github

Was playing with git repositories. There are two contenders : Cloud Foundry and Github. But first on the IDE : since the code I had was Spring-based (MVC and Roo) the choice is Springsource Tool Suite (STS). For Eclipse I was told that for my code, I need to do the extra step of setting up AspectJ. Why the hassle?

Back to git. Cloud Foundry charges $7 per month for two users. Github charges $7 per month for unlimited private repositories and users.

I decided to give Cloud Foundry the first chance. Registering for 30-day free trial was easy. Using steps in some blogs, I could also very easily push code from STS to Cloud Foundry.

But on the site, the code appeared with carriage return ‘\r’ characters at the end of the lines. The raw view was better, but it was not syntax highlighted and the navigation bar does not appear. There was no appealing color slickness to the web view. I did not like it at all.

Next day I tried Github. My first two attempts at pushing the code were long winded. I tried to follow steps in various blog posts and finally ended up sending my project as a folder in the github repository. Meaning, if the repository name on github is myrepository and the project name in STS is myproject, the code appeared as / myuserid / myrepository / myproject. It sucks, I thought. It should be / myuserid / myproject.

Noting that the key step in connecting to a git repo in STS (or Eclipse) is Team -- Share project, next day I again started from scratch. Happily I realized that the steps are pretty straightforward. Github’s web view is very navigable, with pleasing color schemes and syntax highlighting of the code. So for me, github is the clear winner over Cloud Forge.

For configuring STS for github, I am documenting the steps, for my own reference later and they may be helpful to others also:

Setup repository on github. This is one of the easiest things to do in the world.
Open STS
Repository view
Click on Clone a Git repository and add the clone to this view
  URI : Copy uri from github site and paste here
  Protocol : https
    User : enter github id
    Password : enter github password
    Check Store in Secure Store
Click Next
Check box master comes selected
Click Next
  Directory : workspace path\myproject
Click Finish

Project Explorer
Right Click -- New -- Project
General -- Project
Click Next
Project name : myproject
Click Finish
Right click on myproject
Team -- Share project -- Git -- Click Next -- Click Finish

Add Files to your project
Right click on project
Team -- commit
Enter Commit message
Select files
Click Commit and Push

Files appear on your github repository very quickly. Simple and cool.

1 comment:

  1. i follow the same process mentioned above.
    but frequently I am getting error message as [remote - rejected]