GitHub: Add an existing project to GitHub

I have started using Git for personal projects and GitHub is a great source code repository for projects where Git is used as the SCS system.

In this installment I will cover adding an existing Git project to GitHub.

1. Initialize the project as a Git project.
rhasija@rhasija $ git init
Initialized empty Git repository in 	/home/rhasija/workspace/blog_projects/MavenSpringHibernateMockitoDemo/.git/
2. Add files to Git and check status of the current branch:
rhasija@rhasija-desktop $ git add src/* pom.xml 
rhasija@rhasija-desktop $ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
# new file:   pom.xml
# new file:   src/main/webapp/WEB-INF/web.xml
# new file:   src/main/webapp/index.jsp
3. Commit the changes to the local repository:
rhasija@rhasija-desktop $ git commit -m "Initial commit with basic project structure."
[master (root-commit) f73707b] Initial commit with basic project structure.
3 files changed, 33 insertions(+), 0 deletions(-)
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp
4. Give the remote repository location. In Subversion lingo remote here means the server where the project is stored.
rhasija@rhasija-desktop $ git remote add origin git@github.com:RaviH/MavenSpringHibernateMockito.git