The “git” command requires the command line developer tools. Would you like to install?

I am absolutely fresh and new to learning code, using a Udemy course that recommended this software.

My Mac gave me this alert:
The “git” command requires the command line developer tools. Would you like to install?"

Now I’m not quite to sure how to proceed with my course. Apple is automatically telling me to download XCode (another name that is completely new to me). Is this the best/only way of proceeding, and is this going to eat into storage?

■ Install Git on Mac

To install Git on macOS, there are the following 4 options;

The following options are mentioned in the article of

and
Install Git | Atlassian Git Tutorial.

Option 1. Auto install

This option is the easiest way to install Git.

  1. Open a Terminal on your Mac. Now, type the following command into your Terminal.
git --version

If you don’t have git installed already, it will prompt you to install it.
You can install only git by clicking “Install” button.
Or, you can install Xcode with Git component by clicking “Get Xcode”.

Option 2. Git for Mac Installer

  1. Download Git from “Git download” page (mentioned above URL).
  2. Once your download is finished, open the file and go through the installation process.
  3. Done!

Option 3. Install Git with Homebrew

If you have [installed Homebrew to manage packages on OS X, you can follow these instructions to install Git.

  1. Open your terminal and install Git using Homebrew.
brew install git
  1. Verify the installation was successful by typing which git --version.
git --version

Option 4. Install Git with MacPorts

If you have installed MacPorts to manage packages on OS X, you can follow these instructions to install Git.

  1. Open your terminal and update MacPorts.
sudo port selfupdate
  1. Search for the latest available Git ports and variants.
port search git
port variants git
  1. Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
sudo port install git +bash_completion+credential_osxkeychain+doc