Table of contents
- #Day 9 Task of #90DaysofDevops challenge🚀
- 1)What is Git and why is it important?
- 2)What is the difference Between Main Branch and Master Branch?😀
- 3)Can you explain the difference between Git and GitHub?
- 4)How do you create a new repository on GitHub?
- Tasks
- 1)Set your user name and email address, which will be associated with your commits.
- 2)Create a repository named “Devops” on GitHub
#Day 9 Task of #90DaysofDevops challenge🚀
1)What is Git and why is it important?
Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source. it is a distributed version control system that allows developers to track changes to their code and collaborate with others on the same codebase.
Importance of GIt:🤯
Git is a speedy and efficient distributed VCS tool that can handle projects of any size, from small to very large ones. Git provides cheap local branching, convenient staging areas, and multiple workflows. It provides support for non-linear development. Git enables multiple developers or teams to work separately without having an impact on the work of others. It is important because it enables developers to work on the same codebase simultaneously without having to constantly send files back and forth or constantly merge changes manually.
2)What is the difference Between Main Branch and Master Branch?😀
main or master is the default branch when you create a repository. GitHub uses the main as its default branch while other systems still use master
3)Can you explain the difference between Git and GitHub?
Git: Git is a version control system that allows developers to manage changes to their code. GIT will allow installing it on your local system.
GitHub: GitHub is a platform that provides hosting for Git repositories. With GitHub, developers can store their code remotely and collaborate with others on the same codebase. Additionally, GitHub provides a web-based interface for viewing and managing code and several additional features such as issue tracking, pull requests, and wikis.
4)How do you create a new repository on GitHub?
Go to github.com and log in to your account.
Click the “New repository” button.
Enter a name for your repository
Choose whether you want the repository to be public or private.
Choose repository visibility. Click on the public if you want your repository to be cloned by anyone.
Click the “Create repository” button.
5)What is the difference between local & remote repositories? How to connect local to remote?
The local repository is a Git repository that is stored on your computer. Local repositories reside on the computers of team members.
The remote repository is a Git repository that is stored on some remote computer. In contrast, remote repositories are hosted on a server that is accessible to all team members - most likely on the Internet.
Tasks
1)Set your user name and email address, which will be associated with your commits.
To set your user name and email address, which will be associated with your commits in Git, you can use the following command:
git config --global
user.name
"Arijti094"
git config --global
user.email
"
arimanna2000@gmail.com
"
To check the details :
git config
user.name
output:
Arijti094
git config
user.
email
output:
2)Create a repository named “Devops” on GitHub
3)Connect your local repository to the repository on GitHub.
To connect your local repository to the repository on GitHub, you’ll first need to initialize a new Git repository on your local machine. To do this, navigate to the directory where you want to create your local repository, and then use the command “git init”.
ubuntu@ip-172-35-26-179:~$ mkdir devops
ubuntu@ip-172-35-26-179:~$ cd devops/
ubuntu@ip-172-35-26-179:~/devops$ git init
Initialized empty Git repository in /home/ubuntu/devops/.git/
now create a file inside the devops directory
vim testfile.txt
Commit the files that you've staged in your local repository.
git add
testfile.txt
now it's time to commit
ubuntu@ip-172-35-26-179:~/devops$ git commit -m "first commit from singapore"
check the commit id
git log
output:
be2793d (HEAD -> master) first commit from singapore
now Connect your local repository to the repository on GitHub
git remote add origin
https://github.com/Arijit094/Devops.git
git push origin master
give your github user-id and password
Username for 'https://github.com': Arijit094
Password for 'https://Arijit094@github.com': test@123
Now we have successfully Connected our local repository to the repository on GitHub.🥳🤩
Thank you very much for giving your valuable time for reading this article !!☺😊
Arijit Manna