Day 12 Task: Deep Dive in Git & GitHub for DevOps Engineers

Hi, I’m Rakshita. A Cloud, DevOps, AI, and Python enthusiast passionate about learning and simplifying technology for others. I love exploring how modern tools and automation can make systems smarter and more efficient. Here, I write about: ☁️ Cloud & DevOps practices 🤖 AI in the world of automation 🐍 Python for real-world problem-solving 💡 Growth, consistency, and the learner’s mindset My goal is to bridge the gap between learning and doing, and help others grow confidently in the evolving tech landscape.
What is Git and why is it important?
Git is a Version Control System (VCS), which helps to keep track of the versions of a file. It is a free and open-source Version Control System used to handle small to very large projects efficiently. We can switch to any particular versions whenever and however we want.
Git is useful for Collaboration, Version Control, Code Conflicts etc.
What is the difference between Main Branch and Master Branch?
The default branch created locally in git is known as "master", while the default branch created in GitHub is known as "main".
Historically, the primary or the default branch for Git versions was named as "master".
Explain the difference between Git and GitHub?
Git:- Git is Command-Line Interface tool (CLI). It is free, open-source and Distributed Version Control System (DVCS), that tracks the changes in any set of file.
GitHub:- GitHub is Graphical User Interface tool (GUI). GitHub is a web-based hosting service for git repositories. GitHub is more user-friendly, repositories are open here so that developers can contribute to one another's code.
How do you create a new repository on GitHub?
Login to your GitHub account: Go to login page of GitHub (GitHub.com) and enter your credentials to login your account.
New Repository: Click on New to create a new repository.

Enter the details: Enter the repository name, Decription (optional), make it public or private, add README file (optional).

Create repository: Click on to Create Repository.

Created: Your repository has created.

What is the difference between a local & remote repository? How to connect local to remote?
Local repository: A local repository is a copy of the entire project’s history and codebase that resides on a developer’s machine. It allows developers to work offline, experiment with different ideas, and maintain a private workflow.
Remote Repository: A remote repository is a central shared repository hosted on a server, typically accessible over the internet. Examples are GitHub, GitLab, or Bitbucket.
Connect your local repository to remote repository
Make a repository on GitHub (remote) as we made above
Initialize an empty git repository:
git init
- Add remote repository URL:
git remote add origin <remote_repo_URL>
- Push to remote:
git push origin main
Tasks
Task 1:
Set your user name and email address, which will be associated with your commits.
# make directory mkdir DevOps && cd DevOps # initialize git repo git init # set username git config --global user.name "rakshita" #set email git config --global user.email "rakshitabelwal@gmail.com"
Task 2:
Create a repository named "DevOps" on GitHub.


Connect your local repository to the repository on GitHub.
Connecting local repository to remote repository using Personal Access Token (PAT):
- Create a PAT from your GitHub account-
Login to github -> Go to Settings -> Developer Settings -> Personal Access Token -> Token (Classic) -> Generate New Token -> Copy the token and save it somewhere
git remote add origin <remote_repo_URL>
git remote -v

git remote set-url origin https://<PERSONAL_ACCESS_TOKEN>@github.com/RakshitaBelwal/DevOps.git
git remote -v
Create a new file in Devops/Git/Day-02.txt & add some content to it.
mkdir -p DevOps/Git && cd DevOps/Git touch Day-02.txt
Push your local commits to the repository on GitHub.
git add Day-02.txt git commit -m "My first commit" git push origin master
Conclusion
Mastering the basics of Git and GitHub is essential for anyone involved in software development or version control. With these tools, developers can streamline their workflows, ensure code integrity, and collaborate more effectively, making Git and GitHub foundational skills in modern development practices.
HAPPY LEARNING🚀



