25 January 2010

Share Source Code Using GitHub- It's Social Coding!

Done writing the codes of your current project? And is excited about it and want the whole developer community to know about your latest project? Then Lets Git It!

Yes, I am also equally excited about my latest project and I wanted it to share with the developer community through GitHub-Social Coding!

The application was developed using Ruby On Rails and hence the hosting provider is HostingRails. So I have my application running up there. So all I had to do was commit the source code from HostingRails into the GitHub repository.

I will be explaining the exact procedure that I followed to commit the source code of my application into GitHub repository directly from HostingRails.
I use PuTTy which is an open source telnet and SSH Client for the Windows and Unix platforms.

Since my application was hosted in HostingRails, I logged into it via PuTTy and I was taken into my root folder. If you are not aware of PuTTy interface, then I would say it is just a Unix Terminal for you to work on. So from the root folder I had to get in my project folder which I did using CD command.

Well before we do anything , a GitHub account is necessary or else where are we going to commit all our source code! So I did create a GitHub Account and I am all set for Social Coding.

Next I had to create a New repository.(See Images)








Once I provided all the information for creating the repository, I hit create-repository. And that's all. After I created the repository, I was redirected to the new repository page which had the basic information on how to commit the source codes.

here's what i did for committing the source code for my application.

In PuTTy, as i was already in my application folder:

email@email.com [~/rails/My_Project]#

Next i had to initialize the git in my application:


email@email.com [~/rails/My_Project]#git init
Initialized empty Git repository in /home/fedenac/rails/testing/.git/

Once initialized, I had to include all the folders and files.

email@email.com [~/rails/My_Project]#git add .

And after that commit it


email@email.com [~/rails/My_Project]#git commit -m 'any message here'

Then I had to add the remote origin


email@email.com [~/rails/My_Project]#git remote add origin git@github.com:techslam/test.git

In the above command "git@github.com:techslam/test.git" is the URl which we find at the top of the page after successfully creating the repository.(See Image)



And finnaly we push it:


email@email.com [~/rails/My_Project]#git push origin master

And that's it. When I checked my repository all my source code was ready to be shared with the wonderful development community out there.

So Folks, what's your say on GitHub feature. I am really enjoying it and is going to explore it deeper and deeper.

2 comments:

  1. nice 1.Its nt advisable to commit directly 4m ur server. better do it 4m ur local.

    ReplyDelete
  2. Hi Aslam, this is really nice experience.. I'm starting up with GitHub also. If you are interested, welcome:

    http://abeletsky.blogspot.com/2010/07/github-social-coding.html

    ReplyDelete

Share your thoughts, Lets have a discussion :)