Before you start using or learning git the first thing you need to do is install Git on your computer it could be Windows or MacOs.
Git is a version control system or VCS, that allow developers to improve the way they work on their code as well as collaborate easier with other developers in software development projects.
Since its inception, Git has become an essential tool for anyone who is working in Software Industry.
Install Git on Windows
If you have windows 10 the best way to install Git is with the help of chocolatey. A windows package manager.
To begin the process, open the Windows Command Prompt as administrator. (just search for “Command Prompt” and right click and click again on run as administrator.
This will display a prompt,
simply press yes.
Keep in mind that Command Prompt must be run as administrator in order to install chocolatey and git.
Once you open the command prompt enter the following command
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Wait a few seconds for the command to complete. If you don’t see any errors, you should be ready to use Chocolatey!
Now, type the following command to make sure Chocolatey is installed properly
If it show the Chocolatey version at the end like image below that means everything is ready.
Finally, we can install Git.
Before that just restart the Command Prompt as administrator
After that, Enter the following command.
choco install git.install
And just press enter. You want to say yes to run the script when prompted by Typing Y and press enter again.
And, This will install the git on your windows computer successfully.
In upcoming lessons whenever I mention opened the terminal, I’m referring to the windows “git bash” program.
To get to the git bash just look at the windows menu and search for git bash. And that will open the git bash propped.
Install Git on Mac Os
The best way to install Git in Mac OS is by using homebrew, which is a package manager similar to red hat’s yum or ubuntu’s app Git.
To install homebrew in your computer head over to their website at brew.sh,
Then open a terminal window you can find it on the applications
Then copy and paste command from the homebrew website as shown in the image below.
After installing enter the following command to see if everything is installed properly.
brew install git
And you should be set to start using Git.
If for some reason you don’t want to use homebrew and you are in MacOS 10.9 Mavericks and above you can install Git by using the X. code development tools.
Just open the terminal. And type
You’ll get this prompt that says the git command requires the command line developer tools would you like to install the tools now. Just press install button and you wait for the installation process to finish.
However, this is not the best way to install Git since this method usually installs on an older versions.
I really recommend you use homebrew as I describe above.
Install Git on Linux
If you use LINUX, GIT normally comes pre-install. If you don’t already have Git installed on your Linux machine, just use the following command on Ubuntu.
apt-get install git-core
Or, On Red hat use following command
yum install git
After Git successfully installed, you can issue the following command to display the version of Git installed:
That’s pretty much you should be able to use Git now on any type of computer.