Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers.
What is Git and why is it important?
Git is a Version Control Tool developed by Linus Torvald who also gave Linux to the world. Git can track our file changes regarding many parameters like creation, modification, and deletion details by users and can help you get back to your previous action. It's just like creating new versions of our work and we can switch back to any version as per our desire hence this is called a version control system tool.
Why it is important: If you have made some changes to software files and you feel that is not good then you retrieve the previous state of the software quickly with the git tool. You can collaborate with people to
What is the difference Between Main Branch and Master Branch?
In Git, the terms "main" and "master" are both used to refer to the primary branch in a repository.
The term "master" was used as the default name for the primary branch in Git. But this term was replaced with "main" due to concerns about the differentiation mentality of the term "master" like "master: slave" terminology.
Can you explain the difference between Git and GitHub?
Git and GitHub are related but different tools.
Git is a distributed version control system that allows developers to track changes to their code over time. It allows us to create and manage different versions of their code, collaborate with others, and easily roll back to a previous version if necessary. Git is a command-line tool that can be used on local machines.
GitHub is a web-based hosting service for Git repositories. It provides a platform to collaborate on code, host Git repositories, and manage the entire software development process. GitHub has a variety of features including code review, issue tracking, project management tools, etc.
How do you create a new repository on GitHub?
Go to the GitHub website and sign in to your account.
Click on the "+" icon in the top right corner of the page and select "New repository".
Choose a name for your repository. Select appropriate options to create your repository.
It's done.
What is the difference between local & remote repositories? How to connect localhost to remote?
A local repository is a copy of a repository that is stored on your local machine, while a remote repository is a copy of the same repository that is stored on a server or a cloud-based hosting service, such as GitHub. the local repository is stored on your machine and can only be accessed by you, while a remote repository can be accessed by anyone who has permission to access it.
Connect a local repository to a remote repository:
Create a new repository on the remote server (GitHub) and clone it to the local machine using the"
git clone {repo url}
"or
Create a local repo with the same name as the remote repo name.
Add remote access to the repo: "
git remote add origin {remote repository URL}
"Verify the connection between the local and remote repositories using the command "
git remote -v
"Push the local repository to the remote repository using the command
"git push origin main"
Pull updates from a remote repository to the local repository using the command "
git pull origin main
"
Tasks
task-1:
- Set your user name and email address, which will be associated with your commits.
task-2:
- Create a repository named "Devops" on GitHub
- Connect your local repository to the repository on GitHub.
- Create a new file in Devops/Git/Day-02.txt & add some content to it.
- Push your local commits to the repository on GitHub
Day09 task is completed!
90DaysOfDevOps Tasks👇