Installing and using Git and GitHub on Ubuntu Linux: A beginner’s guide

Git and Github

GitHub is a treasure trove of some of the world’s best projects, built by the contributions of developers all across the globe. This simple, yet extremely powerful platform helps every individual interested in building or developing something big to contribute and get recognized in the open-source community.

This tutorial is a quick setup guide for installing Git and using GitHub and how to perform its various functions of creating a repository locally, connecting this repo to the remote host that contains your project (where everyone can see), committing the changes and finally pushing all the content in the local system to GitHub.

Please note that this tutorial assumes that you have a basic knowledge of the terms used in Git such as push, pull requests, commit, repository, etc. It also requires you to register to GitHub here and make a note of your GitHub username. So let’s begin:

Git Commands

Git Commands

Installing Git for Linux

Download and install Git for Linux.

sudo apt-get install git

The above command is for Ubuntu and works on all Recent Ubuntu versions, tested from Ubuntu 16.04 to Ubuntu 18.04 LTS (Bionic Beaver) and it’s likely to work the same way on future versions.

Configuring GitHub

Once the installation has successfully completed, the next thing to do is to set up the configuration details of the GitHub user. To do this use the following two commands by replacing “user_name” with your GitHub username and replacing “email_id” with your email-id you used to create your GitHub account.

git config --global user.name "user_name"git config --global user.email "email_id"

The following image shows an example of my configuration with my “user_name” being “atdilshan” and my “email_id” being “abc123@gmail.com”

Creating a local repository

Create a folder on your system. This will serve as a local repository which will later be pushed onto the GitHub website. Use the following command:

git init Mytest

If the repository is created successfully, then you will get the following line:

Initialized empty Git repository in /home/akshay/Mytest/.git/

This line may vary depending on your system.

So here, Mytest is the folder that is created and "init" makes the folder a GitHub repository. Change the directory to this newly created folder:

--

--

--

Hi! My Name is Antony Thevathas Dilshan. I am 20 years old. I ‘m a IT Enthusiast. I believe in helping people with my abilities and knowledge.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Unit Testing a Jenkinsfile

Networking 101 GCP reference sheet

networking 101

How to Dream in Python

NZ COVID-19 Lockdown Day 33 — The end of the beginning

How to write basic Java Programs

8 Web Design and Development Tools You Need to Know About

Testing Google Cloud Platform PubSub with Testcontainers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dilshan AT

Dilshan AT

Hi! My Name is Antony Thevathas Dilshan. I am 20 years old. I ‘m a IT Enthusiast. I believe in helping people with my abilities and knowledge.

More from Medium

Node.js + PostgreSQL CRUD Automation API

Getting started with Git & GitHub . . .

Introduction to GIT 👨‍💻👩‍💻