Basic of Git and GitHub as a DevOps Engineer should never miss

Basic of Git and GitHub as a DevOps Engineer should never miss

ยท

2 min read

Introduction to Git ๐Ÿš€

A Git is a game-changer in version control. Git isn't just for software development; it's a versatile tool for tracking changes in any file set. What fascinated me most is its ability to record who changed what and when, and the ease of reverting to previous versions.

Discovering GitHub ๐Ÿ’ป

GitHub is not just a platform but a community hub where developers collaborate. Owned by Microsoft, GitHub takes Git's functionality and adds a layer of social networking, issue tracking, and one of the project (repo) management tools.

How to Install Git on your computer (if it is not already installed)

Git is a version control system that is used to track the changes of a file among multiple people.

To install git run the following command

sudo apt-get install git -y


Create a free account on GitHub (if you don't already have one)


Task 1: Make some changes to a file in the repository and commit them to the repository using Git

Create one file

sudo touch DevOps

Add it to the staged area

sudo git add DevOps

Commit changes

sudo git commit -m "File added"

Task 2: Push the changes back to the repository on GitHub

Push to GitHub Repository

sudo git push origin master

If above command doesn't work

Follow these steps:

  1. Create a personal access token for your GitHub repo

Go to Settings > Developer Settings > Personal Access Tokens > Generate New Token

    1. Now, set GitHub remote URL from git, use the following syntax
    sudo git remote seturl origin https://<github_accessstoken>@github.com/itztejal/90DaysofDevOps.git

3. Now push to the repository.

Happy Learning!!

Thanks For Reading :)

ย