Go To the home brew webpage
https://brew.sh/
copy the script provided under Install Homebrew
Open Terminal via spotlight search
Then open the terminal in the using the spotlight search by pressing the command + spacebar
now in the terminal paste the script which was copied from the homebrew site
it will ask to click return button after some time so don't worry after successful installation the brew won't work as for M1 Chip MacBook air.
It will show some warning for the path i.e. warning: /opt/homebrew/bin is not in your PATH
==>Now on the same terminal we will create the file .zshrc in the home directory
So Run the command to create this directory i.e.
touch .zshrc
Now we will open the home directory
To open home directory we will open the finder from the dock and make sure its the active application
now in the finder app we will press button to open the home directory i.e.
command+shift+H
After this finder will open the home directory
Now since the .zshrc is a hidden file as we created it using the terminal above
Now to access the hidden file press the button i.e.
shift + command + .
After this locate the .zshrc file and click to edit with Text Editor option
Set the path in .zshrc file
Now at the end of the line paste this -
export PATH=/opt/homebrew/bin:$PATH
Now we will make this file available
So type paste this code in the terminal
source ~/.zshrc
After this command run one more command on the terminal to check if the howebrew is working fine
brew
On typing this you will get to know that home brew is now working!!
Now do what ever you want to do using brew either install git or any other things which you want....
Have a Good Day Guys!!