7.9 KiB
Installing Git
The following are the steps in install Git on either Linux, Windows or Mac.
These steps were created using ChatGPT, so there might be some errors.
If you run into errors, or if there's any missteps please log an issue here:
https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials/issues
or create a pull request with the change. Thank you.
Linux
1. Check if Git is Already Installed
Before installing, check if Git is already installed by running: How to open the terminal
sh
git --version
If Git is installed, it will display the version. If not, follow the steps below.
2. Install Git Based on Your Linux Distribution
Debian/Ubuntu-based distributions (e.g., Ubuntu, Linux Mint, Pop!_OS)
sh
sudo apt update sudo apt install git -y
Fedora
sh
sudo dnf install git -y
Arch Linux/Manjaro
sh
sudo pacman -S git
openSUSE
sh
sudo zypper install git
RHEL/CentOS (8 and later)
sh
sudo dnf install git -y
For CentOS 7 (uses yum instead of dnf):
sh
sudo yum install git -y
3. Verify Installation
After installation, confirm that Git is installed by running:
sh
git --version
You should see output like:
nginx
git version 2.x.x
4. Set Up Git (First-Time Configuration)
After installing, configure your Git identity:
sh
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
To check your configuration:
sh
git config --list
Add the following settings. The repo is large, so the following settings prevent cloning errors.
sh
git config --global core.compression 0
Long answer here
sh
git config --global http.postBuffer 1048576000
Long answer here
Git is now installed and ready to use! 🚀
Windows
1. Download Git for Windows
- Go to the official Git website: https://git-scm.com/downloads
- Click on Windows to download the latest Git installer.
2. Run the Installer
- Locate the downloaded
.exefile (e.g.,Git-2.x.x-64-bit.exe) and double-click it.
3. Follow Installation Steps
- The following are most likely default settings during installation. If unsure, go with the prompted defaults.
- Select Destination → Choose where Git will be installed (default is fine).
- Choose Components → Keep the defaults unless you have specific needs.
- Select Default Editor → Choose an editor for Git (default is Vim, but you can select Notepad++, VS Code, etc.).
- Adjust Path Environment → Choose:
- "Git from the command line and also from 3rd-party software" (Recommended)
- Choose HTTPS Backend → Use the default "Use the OpenSSL library."
- Choose Line Ending Conversion → Select:
- "Checkout Windows-style, commit Unix-style line endings" (Recommended)
- Configure Terminal Emulator → Choose:
- "Use MinTTY" (default) or Windows Console Window (if you prefer
cmd).
- "Use MinTTY" (default) or Windows Console Window (if you prefer
- Default Behavior for
git pull→ Choose:- "Default (fast-forward or merge)" (unless you prefer rebase).
- Enable Experimental Features → Optional.
4. Finish and Verify Installation
-
Click Install, then Finish once done.
-
Open Command Prompt or Git Bash and type: How to open the terminal
sh
git --versionIf Git is installed correctly, it will return the installed version.
5. Set Up Git (First-Time Configuration)
Open Git Bash or Command Promptand configure your name and email:
sh
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
To check your configuration:
sh
git config --list
6. A few settings
-
A few Windows configurations. These are important as some of the videos have long names, and this will trigger an error when cloning the repo.
-
Set longpath on windows
- Long answer here
- Short answer
- Go to start menu and type 'regedit'
- Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
- Right click on
LongPathsEnabledand thenModify... - Value data: 1
- Short answer
- Long answer here
-
Run Git Bash in administrator mode, like this and do the following commands. Do them in the exact following order.
-
Now, Git is installed and ready to use on Windows! 🚀
Mac
You can install Git on macOS using several methods. Here are the most common ones:
1. Check if Git is Already Installed
Before installing, check if Git is already available by running: How to open the terminal
sh
git --version
If Git is installed, it will display the version. If not, proceed with one of the installation methods below.
2. Install Git Using Homebrew (Recommended)
Homebrew is a package manager for macOS that makes installing Git easy.
Step 1: Install Homebrew (if not already installed)
If you don’t have Homebrew, install it by running:
sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install Git
Once Homebrew is installed, install Git with:
sh
brew install git
Step 3: Verify Installation
After installation, check the Git version:
sh
git --version
3. Install Git via Xcode Command Line Tools (Alternative)
macOS includes a lightweight version of Git with Xcode’s command-line tools.
Step 1: Run the Installation Command
sh
xcode-select --install
Step 2: Follow the On-Screen Prompts
- A pop-up will appear asking if you want to install the tools. Click "Install".
- Wait for the installation to complete.
Step 3: Verify Installation
sh
git --version
4. Install Git via the Official Git Installer
If you prefer, you can download Git directly from the official site.
Step 1: Download Git for macOS
Go to https://git-scm.com/download/mac and download the latest .dmg installer.
Step 2: Install Git
-
Open the
.dmgfile and follow the installation steps. -
After installation, restart your terminal and verify Git is installed using:
sh
git --version
5. Set Up Git (First-Time Configuration)
After installation, configure Git with your name and email:
sh
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
To check your configuration:
sh
git config --list
Add the following settings. The repo is large, so the following settings prevent cloning errors.
sh
git config --global core.compression 0
Long answer here
sh
git config --global http.postBuffer 1048576000
Long answer here
Now, Git is installed and ready to use on your Mac! 🚀