303 lines
No EOL
7.9 KiB
Markdown
303 lines
No EOL
7.9 KiB
Markdown
# Installing Git
|
||
The following are the steps in install Git on either [Linux](#linux), [Windows](#windows) or [Mac](#mac).
|
||
|
||
|
||
|
||
*These steps were created using ChatGPT, so there might be some errors.*
|
||
<br>
|
||
*If you run into errors, or if there's any missteps please log an issue here:*
|
||
<br>
|
||
*https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials/issues*
|
||
<br>
|
||
*or create a pull request with the change. Thank you.*
|
||
|
||
|
||
|
||
<br>
|
||
|
||
# Linux
|
||
|
||
|
||
### **1. Check if Git is Already Installed**
|
||
|
||
Before installing, check if Git is already installed by running:
|
||
[*How to open the terminal*](Open%20Command%20Prompt%20or%20Git%20Bash.md#linux)
|
||
|
||
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](https://stackoverflow.com/a/22317479)
|
||
|
||
sh
|
||
`git config --global http.postBuffer 1048576000`
|
||
Long answer [here](https://stackoverflow.com/a/6849424/414643)
|
||
|
||
Git is now installed and ready to use! 🚀
|
||
|
||
<br>
|
||
|
||
# Windows
|
||
|
||
### 1. **Download Git for Windows**
|
||
|
||
- Go to the official Git website: [https://git-scm.com/downloads](https://git-scm.com/downloads)
|
||
- Click on **Windows** to download the latest Git installer.
|
||
|
||
### 2. **Run the Installer**
|
||
|
||
- Locate the downloaded `.exe` file (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`).
|
||
- **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*](Open%20Command%20Prompt%20or%20Git%20Bash.md#windows)
|
||
|
||
sh
|
||
`git --version`
|
||
|
||
If Git is installed correctly, it will return the installed version.
|
||
|
||
### 5. **Set Up Git (First-Time Configuration)**
|
||
|
||
Open **Git Bash** or **Command Prompt**and 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](https://www.youtube.com/watch?v=mAGQZ7RvKFk)
|
||
- Short answer
|
||
- Go to start menu and type 'regedit'
|
||
- Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
|
||
- Right click on `LongPathsEnabled` and then `Modify...`
|
||
- Value data: 1
|
||
|
||
- Run **Git Bash** in administrator mode, like [this](https://www.dropbox.com/s/wk3l5weh1pt70oh/3TOLBa3Rs0.mp4?dl=0) and do the following commands. Do them in the exact following order.
|
||
|
||
1. `git config --system core.longpaths true`
|
||
- Long answer [here](https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows/22575737#22575737)
|
||
2. `git config --system --unset core.autocrlf`
|
||
3. `git config --global core.autocrlf true`
|
||
4. `git config --global core.compression 0`
|
||
- Long answer [here](https://stackoverflow.com/a/22317479)
|
||
5. `git config --global http.postBuffer 1048576000`
|
||
- Long answer [here](https://stackoverflow.com/a/6849424/414643)
|
||
|
||
Now, Git is installed and ready to use on Windows! 🚀
|
||
<br>
|
||
|
||
# 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*](Open%20Command%20Prompt%20or%20Git%20Bash.md#max)
|
||
|
||
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](https://git-scm.com/download/mac) and download the latest `.dmg` installer.
|
||
|
||
#### **Step 2: Install Git**
|
||
|
||
- Open the `.dmg` file 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](https://stackoverflow.com/a/22317479)
|
||
|
||
sh
|
||
`git config --global http.postBuffer 1048576000`
|
||
Long answer [here](https://stackoverflow.com/a/6849424/414643)
|
||
|
||
|
||
|
||
|
||
----------
|
||
|
||
Now, Git is installed and ready to use on your Mac! 🚀 |