A Git guide for a beginner: how to start and build your first repository

Samitha Neranjan Liyanage
5 min readFeb 22, 2021

This article is made for you if you are a developer and you want to get going with Git and GitHub.

After studying this blog, You will be able to construct and work on a project on GitHub.

WHAT IS GIT?

In 2005, by Linus Torvalds developed Git as a free and open source software. Actually, this tool is a version control system that was originally designed to work with multiple Linux Kernal developers.

VERSION CONTROL?

I will explain you to what is the “Version Control System(VCS)” is. Version control is a management mechanism that records the modifications to a file or collection of files that you make (such as a code project). In this scheme, developers will cooperate on one project and work together.

The branching system is version controlled and allows developers to work individually on an issue (for example, one branch, one issue, or one branch, one developer) before merging all the changes made by co-authors into the main branch.

In history, all improvements made by developers are tracked and saved. Keeping track of the improvements made by each contributor can be useful.

GIT REPOSITORIES

You need to know where to host your repositories if you want to start using Git. There are several hosting sites where you can set the code free of charge. Some choices aren’t secure, but most of the time, you don’t need them except in specific situations.

1. GitHub

2. GitLab

3. BitBucket

In above I mentioned some of popular git hosting services.

There are two ways of Hosting platforms.

1. On the cloud

2. Self-installed on developer server.

AS A DEVELOPER, WHY YOU USE GIT

1. Act with your buddies without sending an e-mail to the compressed project any time the code changes.

2. You don’t want to memories what you did. You need a quick command to review the improvements from the last time you saved your job.

3. Delete and split your code; you only need to type a command to get back to the previous version and resume your work.

4. No more versions, when you complete a big upgrade for your application or repair a bug, you only need to “push” your project online to save it.

These are some popular advantages.

GIT and GITHUB

Let’s we learn how to manage projects through the GitHub by doing some exercises. In here I use GitHub as our Hosting service. Other services also has a same procedure like as GitHub.

#1 step

This first exercise is not quite complicated; it is split into two steps. Installation of Git and formation of GitHub account.

GitHub account creation

To build your account, you need to log in to the main GitHub website and fill in the registration form.

In here

GitHub registration form

After that you must install Git tools on your computer. In here to communicate with GitHub, I use command line.

In here I only for demonstrate to for Windows users.

First — Download the latest Git for Windows installer.

After that follow the instructions on the computer

After that will open powershell or git bash terminal.

Next you have to verify that actually Git installed on your computer correctly.

As a last step of complete the installation. This step is for set a default username and email when we are going to save our work so that run in terminal the following commands with your info.

These commands are comfortable for Ubuntu, MacOS and Windows users.

#2 step

In this step let me tell you how to start your first GitHub project. First go to the main GitHub page in the menu bar you can see the “+” icon. Click it.

Git Hub menu bar

After that open a new menu. Then you can see a “New repository” option. Click on it!

Then you can see repository creation page appeared. The creation page of the repository will appear. Choose a name for your repository and enter a small description before clicking on the “Create repository” button.

Repository creation menu page

Okay! You created a GitHub repository.

#3 step

In this step I will show you to

· A local version of your project

· Repository edition

· How share work

Your first job is to get a copy of the Repo on your computer. You ought to “clone” the archive to do so. You need to get the “HTTPS” key on the repository tab.

Repo page

Now you have to use shell commands, to move to the location where you want to put a copy of the directory . Now enter;

At the given address local copy of the repo will host.

Now repo is in your computer. You will now create a file called “README.md” in your folder.

After, You have to do committing. That means saving project after modified.

You have to follow 4 steps to save your work. Return to your terminal,

· status

To check the files you have modified.

· add

With the support of the change list, can add all the files

following command:

In here I going to add README.md

· commit

Now files have added. Now we should put a note as explaining what we have done. This will useful in future to us.

· push

By giving below command you will be able to all works of your put online on the repo page.

Now you can see README.md file on your GitHub repository page.

Thanks for read my blog post. Have a nice day!

--

--

Samitha Neranjan Liyanage

I am an undergraduate student at the Unversity of Moratuwa.