Setup remote Git repository

Have started working on another experimental project. This project is specifically for my learning purpose. I’m trying to automate few of my regular tasks. The same way I resolved earlier Reminder service or Automatically send emails using filters or Auto login to internet portal etc. Would like to tag these as ‘food for thought’. Will come back to new project details in a few months. This time I’m thinking in some broader aspect. To initiate that, the very first step is to set up its configuration properly. That is the reason behind this post.

Install Git

$ sudo apt-get update
$ sudo apt-get install git
That’s pretty straightforward. Useful details on github-ssh connectivity is here.

Create local repository

$ cd java-setup/
$ ls -lt
total 8
drwxrwxr-x 2 kuntal kuntal 4096 Jan 2 14:31 bin
drwxrwxr-x 2 kuntal kuntal 4096 Jan 2 14:31 src

$ git init
Initialized empty Git repository in /var/www/java-setup/.git/

$ git config --global "kuntalchandra"
$ git config --global
Created the gitignore file
$ cat .gitignore


# Mobile Tools for Java (J2ME)

# Package Files #

# virtual machine crash logs, see

Git will read this file and skip the files and folders I listed there. This is necessary when we work with temp or personal files that we don’t want to commit in the repository.
Created the readme file from template
$ cat

## Synopsis

At the top of the file there should be a short introduction and/ or overview that explains **what** the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

## Code Example

Show what the library does as concisely as possible, developers should be able to figure out **how** your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

## Motivation

A short description of the motivation behind the creation and maintenance of the project. This should explain **why** the project exists.

## Installation

Provide code examples and explanations of how to get the project.

## API Reference

Depending on the size of the project, if it is small and simple enough the reference docs can be added to the README. For medium size to larger projects it is important to at least provide a link to where the API reference docs live.

## Tests

Describe and show how to run the tests with code examples.

## Contributors

Let people know how they can dive into the project, include important links to things like issue trackers, irc, twitter accounts if applicable.

## License

A short snippet describing the license (MIT, Apache, etc.)

$ git status
On branch master
Initial commit

Untracked files:
(use "git add ..." to include in what will be committed)


nothing added to commit but untracked files present (use “git add” to track)

$ git add --all
$ git commit -m "Initial commit"
[master (root-commit) 34a8ff3] Initial commit
4 files changed, 70 insertions(+)
create mode 100644 .gitignore
create mode 100644
create mode 100644 src/
create mode 100644 src/

Local git repository has been configured.

Create the remote repository

A remote repository is actually a central repository where others can push their changes to it. It’s nothing other than the remote copy of the same Git repository created locally.

$ ls -lta
total 36
drwxrwxr-x 8 kuntal kuntal 4096 Jan 2 15:04 .git
drwxrwxr-x 5 kuntal kuntal 4096 Jan 2 15:00 .
-rw-rw-r-- 1 kuntal kuntal 212 Jan 2 15:00 .gitignore
-rw-rw-r-- 1 kuntal kuntal 1300 Jan 2 14:59
drwxrwxr-x 2 kuntal kuntal 4096 Jan 2 14:57 src
drwxrwxr-x 2 kuntal kuntal 4096 Jan 2 14:56 bin
-rw-rw-r-- 1 kuntal kuntal 226 Jan 2 14:56 .classpath
-rw-rw-r-- 1 kuntal kuntal 368 Jan 2 14:56 .project
drwxrwxrwx 4 kuntal kuntal 4096 Jan 2 14:56 ..

$ git remote add origin
$ git push -u origin master
As the repository is public, so protect code from force push to master branchselection_001


One thought on “Setup remote Git repository

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s