Install Git
Git comes ready on most computers. This lesson checks for it and installs it when it is missing.
Check first
A version number means Git is already there. No install is needed.
$ git --versionInstall it when it is missing
Each line is the install step for one system. Run only the line for yours.
$ xcode-select --install
$ sudo apt install git
$ winget install Git.GitExample
$ git --version
$ which gitKey points
- On Mac, Git arrives with the developer tools.
- On Linux, Git arrives with the system packages.
- On Windows, Git arrives with Git for Windows.
- The install takes a few minutes.
- After the install, the version command must print a number.
- A missing Git means the install step was skipped.
- The version number differs by machine, and that is fine.
Here, two checks confirm the install. The version is 2.43.0. The program lives in /usr/bin. Both answers mean Git is ready.
Note
You need Git once. The rest of the course only uses it.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
Git is missing. What do you do first?