Git for beginners : setting up your first project

General

Git for beginners : setting up your first project

3 min read
prototype
github

The Git version control system is a staple when it comes to coding. You definitely need the coding if you are starting some IoT project. This article shortly explains what is git and about the tools which use git to make developers life easier.

What is git?

Git is an open-source version control software created by the creator of Linux, Linus Torvalds. However, there are other alternatives to git. But, git is a standard software for version control.

If you are wondering why you need git, think about 3 people working on the same project. They just need to host your repository somewhere (like GitHub) and collaborate. So, developers can create branches from the current code base and work on a task. After it is done, they can merge it back to the main branch. All changes made by each developer can be tracked and saved in history, thanks to git. As GitHub is in the cloud, for example, your code is not lost if you accidentally lose the local code.

What is Github?

There are various hosting services for git like Github, Gitlab, BitBucket, etc which are owned by different companies. One of the most used ones is GitHub, which is owned by Microsoft. In this article, we will see how we can use GitHub to host your first repository.

Your first repository

Follow these steps to create your first repository on GitHub.

Step 1 : Sign up / Login to GitHub

Go to https://github.com/ on your web browser. Click on the Signup button on the top left to sign up to GitHub.

Step 2: Creating a repository

Click on + sign on the top right when you are logged in

git1.PNG

Click on "New repository" and you should get this page

opening git account

Enter the name of the repository and optional description. Select public/private depending on if you would like others to see your repository. Now click on "Create Repository". Your repository is now created!

Step 3: Accessing the repository from your development machine

If you are using windows, you need to download and install .exe from Git installer for Windows. It is a fairly similar process in windows, but now I will continue assuming you have a Linux environment.

If you are using Ubuntu, open the terminal and run

$ sudo apt update
$ sudo apt install git

Now, login with your GitHub credentials

$ git config --global user.name "Your name"
$ git config --global user.email "your-email@mail.com"

Step 4 : Cloning the repository

Now, go back to GitHub and click on the "code" tab and click the HTTPS tab like so.

git3.PNG

Copy the link in the text box. Now, in your Linux terminal,

$ git clone < link you copied> 

Ta-dah! You have your repository in your local machine.

Now, you can use code editors like Visual Studio Code to create your first code and push to your remote repository (the one in the cloud). More on that in Git for beginners : Git basics you need to know

More Posts

Web of Things ( WoT ) Explained
General

The Internet of Things has revolutionized the way we interact with our devices, but it also brings new challenges in terms of interoperabili...

10 essential tips to speed up software development on Linux
General

Developers who always use Linux can not shut up about it because it is actually that good. It feels like you are coming out of the abstracti...

Git commit best practices
General

This post explains how to write good commit messages and how not to write bad commit messages. Also, you will learn some more best practices...