Day 8 Task: Deep Dive in Git & Github for Devops engineers.
Saurabh Rajput
"DevOps Engineer | Streamlining Development and Operations for Efficient Software Delivery"
What is Git and why is it Important?
Git:- Git is a free open source distributed version control system for handling everything from small to large projects. it is also used for the source code management.
With the help of git you can track the changes or keep the records of who made changes to what part of a file, it easy to collaborate with others as you can share the changes and merge the changes made by different people into a single version of a file.
Git has 2 Types of branches:-
A) Main branch
B) Master branch
How do you create a new repository on Github?
To create a new repository on GitHub:
1 Go to github.com and log in to your account.
2 in the upper right corner, click the + and select the new repository.
3 Give a name for your repository
4 choose you want the repository public and private.
5 Add a Readme file.
6 Click on create repository button.
What is difference between local & remote repository? How to connect local to remote?
Git local repository is?the one on which we will make local changes, typically this local repository is on our computer.
Git remote repositories are hosted on a server that is accessible for all team members.?
A git?remote command?is used to make the remote connections such as connecting a Git local repository with GitHub remote repository.
1.git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
2.git push origin master
Tasks:
1 Set the user name and email address, which will be associated with your commands.
领英推荐
git config --global user.name "saurabh"
git config --global user.email "[email protected]"
git config --list
2.Create a repository named "Devops" on GitHub
3. Connect your local repository to the repository on GitHub.
git remote -v
git init
git remote add origin <URL_from_GitHub_repository>
git remote -v
git remote add origin [email protected]:saurabh/devops.git
git remote -v
4.Create a new file in Devops/Git/test.txt & add some content to it.
git status
git add
git status
git commit -m "add file name"
git status
5.Push your local commits to the repository on GitHub
git push origin master
Thank you for reading article !!