We will be discussing about the git and github account in this blog

  • Git is basically a tool used for the version controlling of the documents. By version controlling we mean that we are maintaining the file where we can monitor all the changes made to it.We can also track who made the changes and compare our file with the previous versions of it to see where the changes were made.It’s really helpful where there are distributed software development and many people are working on same file. It can be managed through github account
  • Using the github account on the www.github.com you can maintain your files on the server.
  • Following are the steps for installing git
sudo apt-get install git

you can also configure username globally or locally for particular project  by using commands below

git config -- global user.name "NAME"
git config -- global user.email "E-MAIL"

OR
You can go to a particular project and set for that

git config --local user.name "NAME"
git config --local user.email "E-MAIL"

and then it will ask for the password of github account

USING WITH GITHUB ACCOUNT
1.)Make a github account on www.github.com.
2.)Create a new repository by clicking “create repository” on the right side and name it say “abc”
3.) Open the terminal window and change the directory to which you want to work in
4.) Now type

git init

( this will initialize an empty repository)
5.) Type

 git add "filename"

(this will add the file to the repository)
6.)Type

 git commit -m "your message"

( this will give a short description to your file on the server)
7.) Type

 git remote add origin 

repository link provided on the github account when you created it ” ( connects to the remote server)
8.) Type

git push origin master

( this will commit the file on the server)
9.) your file is now available on the server, provide anyone with the link address and they can view it.

  • We have another command
 git clone "url" 

This url is the url of the file from the github account that you want to clone. By executing this you can have a local copy of the file which allows you to make changes to it.

For eg:

 git clone git://github.com/user/example.git 

This command creates a directory named “example” and initializes it  a .git directory and  it will have all the data for this repository “user”  and will search for the latest version of the working copy.

  • This clone command differs from the init  in way that we are cloning an existing repository whereas init command  initializes a newly created repository in an existing directory