Deep Dive in Git & GitHub for DevOps Engineers.

Deep Dive in Git & GitHub for DevOps Engineers.

·

3 min read

Task9

What is Git and why is it important?

Ans: Git is nothing but a source code management tool used by developers to update and trace any progress in codes or files in a project and helps them in sorting the work with teamwork efficiency.

The reasons behind its importance are

  1. The first one is its open-source version control system and its easy availability for learners/beginners.

  2. It can easily handle file changes over anytime from any distance which helps in easy collaboration and code review.

  3. It is an essential tool for many software development projects.

  4. Due to its tracing back changes feature, it easily creates a backup.

What is the difference Between Main Branch and Master Branch?

Ans: A branch in Git is used to keep your changes. Each repository can have one or more branches. The default branch of any GitHub repository is using “main” while a "master" branch for any local repository. Users store the source code projects in repositories only.

Can you explain the difference between Git and GitHub?

Ans:

  • Git is a command-line tool software. Git is installed locally on the system and maintained by Linux. Git is focused on version control and code sharing. Git is a version control system to manage source code history. Git has no user management feature.

  • GitHub is a web-based service platform with a graphical user interface. GitHub is hosted on the web by Microsoft. GitHub is focused on centralized source code hosting. GitHub is a hosting service for Git repositories. GitHub has a built-in user management feature.

How do you create a new repository on GitHub?

Ans:

  1. First, go for GitHub's official website and for the new repository you must have an account on GitHub so sign in with your email address.

  2. On your left side in the dashboard or on the right corner of your repo section in your profile, you can see the "+" icon for the new repository click over here and enter the unique repository name with the description as optional.

  3. You can select the public or private option as per your wish. If you go for the public, then the repo will be available for anyone whereas in private you can prioritize the person contributing to your repo.

  4. You can also create README for your repository i.e description of your repository.

  5. Finally "create repository" and here your new repo is created.

What is the difference between local & remote repositories? How to connect local to remote?

Ans: Local repositories are belonging to team members stored on your system whereas Remote repositories are hosted on a server used as a central repository by all team members- most likely on the internet or a local network.

The connection between local and remote can be explained:

Navigate to the local repository on your system.

$ git remote add origin <URL for the remote repository>

$ git push --all origin

You can also specify the branch of the remote repository where you wish to push.

Task-1

Set your user name and email address, which will be associated with your commits.

Ans: To set the user name and email address, use these commands:

  1. git config —-global user.name <name>

  2. git config --global user.email <email-id>

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

Ans:

Reference: https://youtu.be/AT1uxOLsCdk


Thanks for reading!

Keep learning and stay tuned for another blog.