Daily Dairy

Getting started with GIT.

GIT: It is a distributed version control system (system to record changes to files over time) having many features like it helps to add access control,display content of git repository (place where multiple files are located) and help managing multiple repositories.

Create an account:

http://www.github.com

Install GIT.

  • You can use the apt package management tools to update your local package index. Afterwards, you can install GIT:
$ sudo apt-get update
$ sudo apt-get install git

Setup GIT.

  • Now that you have git installed, you need to do a few things so that the commit messages that will be generated for you will contain your correct information.The easiest way of doing this is through the git config command. Specifically, we need to provide our name and email address because git embeds this information into each commit we do. We can go ahead and add this information by typing:
$ git config --global user.name "Your Name"
$ git config --global user.email "youremail@domain.com"
  • We can see all of the configuration items that have been set by typing:
$ git config --list

Creating First Repository.

  • Go to the dashboard of git and click on the + sign which is there in right side at the top. Click on new repository.
  • Give your repository name (Let it be firstrepo) and description as per your choice. Then, you can choose public or private repository.

Create a directory for that Repository.

  • Now create a directory to link it with repository:
$ mkdir firstrepo
  • Open directory:
$ cd firstrepo
  • Create or Copy the files in this directory which you want to upload on git repository name as firstrepo.
  • Now initialize the git in this directory using:
$ git init
  • Now add the newly created or copied file to git using:
$ git add filename
  • You need to commit your file in order to save your changes in git. You can commit your file using:
$ git commit -m “first commit”
  • Now creates a new remote called origin using:
$ git remote add origin https://github.com/username/repositoryname.git
  • Now you can push to origin for that you have to enter github Username and Password.
$ git push origin master

Stay Tuned Thanks 🙂

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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