This post explains how to install and use Git in local computer and connect it to an online repository account in github online account.
If you are using linux. Please install Git package before proceeding further. On ubuntu terminal:
#apt-get install git
The above command will succesfully install git in linux.
Switch to a local directory say "foo" where Git local repository has to be maintained.
Git repository can be either just local or just online repository in github account or both.
Opening a gihub account is free of cost and installing open-source Git package in linux is also free of cost in any local computer.
You can maintain local Git repository which is version controlled completely with free of cost in your local computer. However if you would want to have an online backup of your code in github server, you can create a github account in github.com and choose to have a private repository free of cost for 15GB of storage space. Your online github account can have multiple repositories and each repository can be chosen to be public or private. While public repositories of your git account are visible to all users on internet, private repositories are visible only to people you give permission to view or whom you invite to view. You can also collaborate on github with another account of github restricting the permissions to desired opinions pertaining legal terms and conditions of both github and cybercrime police or website security policies.
Now let's get back to local repository and focus on setting up a local Git repository in your computer.
-Installing git in ubuntu:
#apt-get install git
-Choose a folder foo where the git has to be installed
#cd foo
#git init hello
-- this will create a local Git repository named hello (hello.git) in the directory foo
Any file can now be stored in git repository in version controlled manner. That means you can store many files in git repository and each file with many versions. Each version of the file is numbered or alphanumeric or coded to have an easy and deterministic reference to access in the future.
Let's test git now with simple hello.txt text file.
-create a hello.txt file in foo folder
#touch hello.txt
-the above terminal command would have created a text file hello.txt in foo folder. You can now add this hello.txt file into local version controlled git repository using following command
#git add hello.txt
-the above command would now add a file in git memory buffer which will be committed to be stored in git repository in the future. Git doesn't allow files to be directly stored in git repository without getting passed through the buffer. I personally think git can allow a security layer in certifying the files that are added to the git repository in the git buffer. It will be either paid or according to the terms of git.
-Now to store this hello.txt file in git local repository which is version controlled, we need to move it from git buffer to git storage using git commit command.
-The above command would push the hello.txt file from git buffer to git repository with timestamp, user stamp, message stamp corresponding to the file and coded name to the file so that it can be retrieved or referred to in the future based on the code name.
--the name of text file can be different than hello or the name of git repository. For example it can be world.txt in case you would want to try with a different file name.
"git commit <filename> -m "<message>"
The above command uses the switch "-m" to indicate the message typed inside double quotes of the command above. This message generally describes about the file or the changes that get into the file.
Now your git repository ready and you committed your first file hello.txt into your local version controlled git repository hello.git
Lets discuss about git and its commands and connecting it to online github through digital fingerprint verification security using SSH and OpenSSH protocol.
Cheers,
Yaswanth Raja Akaveeti,
Computer Architect and Software Architect,
Email: yaswanth@kennen.space
Twitter: @A_Yaswanth_Raja
Website: www.kennen.space
Hozzászólások