- What is Git and why is it important?
Git is a distributed version control system (DVCS) used for tracking changes in source code during software development. It is important for the following reasons:
Version Control, Collaboration, Backup and Recovery, Branching,
- What is the difference Between the Main Branch and Master Branch?
The main difference between the main and master branches in Git is primarily a matter of terminology. Historically, the default branch name in Git repositories was master.
Can you explain the difference between Git and GitHub?
Git is a (DVCS) that is used for tracking changes in source code during software development. It allows developers to work collaboratively, manage changes, create branches, and maintain a history of their codebase. Git is a command-line tool and can be used locally on a developer's machine.
GitHub is a web-based platform that provides hosting for Git repositories It includes a web interface for managing Git repositories, code reviews, issue tracking, & more
- How do you create a new repository on GitHub?
(a) Log in to your GitHub account. (b) Click on the '+' (plus) sign icon and select New Repository. (C) Fill out the repository information, including the repository name, description, and visibility (public or private), then Click the Create repository
Your new repository is now created on GitHub. You can then clone it to your local machine to start working on your project.
What is the difference between local & remote repositories? How to connect local to remote?
A local Git repository is the repository that exists on your local development machine. It contains the entire history of your project and allows you to make changes, commit them, and manage versions of your code locally.
A remote Git repository is a repository that exists on a remote server, such as GitHub. It serves as a centralized location where multiple developers can collaborate, share changes, and access the code.
Tasks: 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:
Command: git add Day2.txt
Command: git commit -m "My First Commit"
Command: git push -u origin master
Git will prompt you to enter your GitHub User is password But Better to use your personal access token for authentication.
After a successful push, your changes will be visible in your GitHub repository.