Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Git Tutorial 4 – Create a new Git repository – git init Command

Posted on 02/19/2025 By admin

As a part of GIT Tutorials End To End, we will learn to create or initialize a GIT repo using a very first command called “git init“.

Before you proceed please make sure that GIT is properly installed and configured. If git is not installed or you don’t know how to check then I recommend going through Install GIT On Windows – Step By Step.

Did you know that I have started a YouTube channel as well and I need your support to make it successful. Please do watch content then comment, like, share, and obviously subscribe.

Before learning about the command “git init” let’s understand why do we need this command. As of now with limited knowledge of git, we know that it is a version control system and we can keep a track of changes to a file or set of files. So git automatically will not start tracking changes to any file. We need to let git know where to track and what to track. Here git init comes into the picture.

If you create a new directory or existing directory and try to run a git command “git status” (Note – Just use this command as of now) then you will see the below error.

Follow steps as below:-

  1. Create an empty directory.
  2. Right-click and click on Git Bash Here.
  3. Type a git command as “git status”.

As the new directory is not a git directory it showed a fatal message. The same error message you will get if there is an existing directory with files in it.

The “git init” command creates a new empty git repository or initializes an existing directory as a git directory. Once the directory is a git directory you can run any git commands.

Let’s run “git init” command in Git bash.

You need to notice two points in the above result of the command:-

  1. Initialized empty Git repository in C:/Users/amomahaj/Desktop/NewFolderGitDemo/.git/
  2. (master)

The “git init” command creates a new hidden folder named “.git” in the same directory where it was run. The “.git” folder will save metadata of the new git repository. Once it becomes a git directory the default branch is master. Remember during the installation of git we had an option to change this default branch name.

Suppose you start a new business and open an office. After sometimes when your business grows you open more branches of yours business. The same logic is with git branches. Master is the default branch of git. We will learn more about branches later.

We will not see the content of the “.git” subdirectory as of now.

Can we rerun the “Git init” command again on a git initialized repo?

Answer – Yes we can and It will not override an existing “.git” configuration.

Please subscribe to my YouTube channel Retarget Common to learn from my video tutorials.

Below are important end to end tutorials for Testers:-

Selenium Tutorials

Rest Assured Tutorials

Postman Tutorials

TestNG Tutorials

If you have any doubt, feel free to comment below.If you like my posts, please like, comment, share and subscribe.#ThanksForReading

#HappyLearning

Uncategorized

Post navigation

Previous Post: How To Verify Functionality Of Back To Top Button In Selenium WebDriver
Next Post: TestNG Tutorials 14: Can We Overload Methods In TestNG Class?

Related Posts

October 2019 – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized
TestNG Tutorials 7: How To Create Customized TestNG XML? Uncategorized
FrameOutput – Make Selenium Easy Uncategorized
Git Tutorial 23 – Git Stash Apply – How To Solve Merge Conflict Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark