| Deep Dive in Git & GitHub for DevOps Engineers. |
1.What is Git and why is it important?
-( Git ) Global Information Tracker
-Git is a DevOps tool used for source code management.
-It is a free and open-source version control system used to handle small to very large projects efficiently.
-Git is used to tracking changes in the source code, enabling multiple developers to work together on non-linear development
2.What is difference Between Main Branch and Master Branch??
-The main branch — the one where all changes eventually get merged back into, and is called master.
-This is the official working version of your project, and the one you see when you visit the project repository at github
3.Can you explain the difference between Git and GitHub?
-While Git is a tool that's used to manage multiple versions of source code edits that are then transferred to files in a Git repository,
-GitHub serves as a location for uploading copies of a Git repository. In a sense, then, there's no comparison when it comes to Git vs. GitHub as far as their function.
4.How do you create a new repository on GitHub?
-Create a new repository on GitHub.com. ...
-Open TerminalTerminalGit Bash.
-Change the current working directory to your local project.
-Use the init command to initialize the local directory as a Git repository.
-Add the files in your new local repository.
-Commit the files that you've staged in your local repository.
5.What is difference between local & remote repository? How to connect local to remote?
-Local repositories reside on the computers of team members.
-remote repositories are hosted on a server that is accessible for all team members
- most likely on the internet or on a local network.
#TASK
1.Set your user name and email address, which will be associated with your commits.
-git config --global user.name "example" -git config --global user.email "example.@gmail.com" -git config --list
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
--> mkdir Devops
--> touch Day-02.txt
--> git remote add origin
--> git status
--> git add Day-02.txt
--> git status
--> git commit -m "finnaly adding files"
--> git status
--> git push --all origin
#GitHub Error: Authentication Failed from the Command Line After setting up 2 Factor Authentication on GitHub, When I tried to push a remote repo, the command line threw this error:
-> git push origin my-branch ->Username for 'github.com': myusername ->Password for 'myusername@github.com': mypassword ->remote: Invalid username or password. ->fatal: Authentication failed for 'github.com/my-repository’
-->Go to Settings: -->Then Developer Settings: -->Then Personal access tokens >> Tokens (classic): -->Generate a new Personal Access Token (also classic). -->Paste the Personal Access Token into the “Password” field when you authenticate via the command line.