Day 8:-Basic Git and Github for DevOps Engineers

Day 8:-Basic Git and Github for DevOps Engineers

Git:-Git is a version control system which is used to track changes to your files. With the help of Git, you can track who made the changes, you can revert it to the previous versions, if needed.

Github:-t's like a virtual workspace where you can store all your code files and project resources. With GitHub, you can easily share your code with others by creating a repository (or repo for short). A repository is like a folder that holds all your project's files, including your code, images, documentation, and more. Others can view your code, suggest changes, and even contribute to your project by adding their own code.

Git bash:- Git bash is an application for Windows OS which allows developers to use Git in a command-line -interface.

Task:-

  1. Create a new repository on GitHub and clone it to your local machine

In the above image, I have created a repository by the name of day8_git_task on GitHub.

Click on the <>Code tab for cloning the repository

Now by Git clone CLI command into your Git bash, it will create a copy of the repository in your system.

Now, I have created files and made some changes to it and after that, I did git add.

Git add will create a temporary staging area where all the changes you have made to the file get stored before saving i.e. commit. The dot. means it will take all the files present in the repository.

Now by doing git commit it will permanently save your files in git history. The command git remote -v will give the URL of the remote repository which is Github over here. Origin is the default name given to your remote repository.

To push the code into your remote repository which is Github you have to configure and authenticate yourself. For authentication, I have used a Personal Access token. It is used for authenticating yourself without using your email and password.

The command git remote set-url origin is used for the configuration of a remote repository where I have also passed generated personal access token.

git push origin main:- this command will push your local copy of your repository in your system to GitHub .main is the branch that you have to specify on which this is created.

You can see the branch displayed in your GitHub.