Bonsai_Tutorials/_Setup/Install Git.md
2026-03-28 11:10:58 -05:00

12 KiB
Raw Permalink Blame History

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

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)

sudo apt update sudo apt install git -y

Fedora

sudo dnf install git -y

Arch Linux/Manjaro

sudo pacman -S git

openSUSE

sudo zypper install git

RHEL/CentOS (8 and later)

sudo dnf install git -y

For CentOS 7 (uses yum instead of dnf):

sudo yum install git -y


3. Verify Installation

After installation, confirm that Git is installed by running:

git --version

You should see output like:

git version 2.x.x


4. Set Up Git (First-Time Configuration)

  1. After installing, configure your Git identity:
    • git config --global user.name "Your Name"
    • git config --global user.email "your.email@example.com"
  2. To check your configuration:
    • git config --list
  3. Add these settings. The repo is large, so the following settings prevent cloning errors.

Git is now installed and ready to use! 🚀



Windows

1. Download Git for Windows

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

    git --version

    If Git is installed correctly, it will return the installed version.

5. Set Up Git (First-Time Configuration)

  1. After installing, configure your Git identity:
    • git config --global user.name "Your Name"
    • git config --global user.email "your.email@example.com"
  2. To check your configuration:
    • git config --list
  3. Add these settings. The repo is large, so the following settings prevent cloning errors.

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

git --version

If Git is installed, it will display the version. If not, proceed with one of the installation methods below.


Homebrew is a package manager for macOS that makes installing Git easy.

Step 1: Install Homebrew (if not already installed)

If you dont have Homebrew, install it by running:

/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:

brew install git

Step 3: Verify Installation

After installation, check the Git version:

git --version


3. Install Git via Xcode Command Line Tools (Alternative)

macOS includes a lightweight version of Git with Xcodes command-line tools.

Step 1: Run the Installation Command

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

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 .dmg file and follow the installation steps.

  • After installation, restart your terminal and verify Git is installed using:

    git --version


5. Set Up Git (First-Time Configuration)

  1. After installing, configure your Git identity:
    • git config --global user.name "Your Name"
    • git config --global user.email "your.email@example.com"
  2. To check your configuration:
    • git config --list
  3. Add these settings. The repo is large, so the following settings prevent cloning errors.

Now, Git is installed and ready to use on your Mac! 🚀


Git Settings For Windows/Mac/Linux

These are important as some of the videos have long names, and this will trigger an error when cloning the repo. Run the following commands from your command line

important: open the command line as the administrator.

  1. git config --system core.longpaths true
  2. git config --system --unset core.autocrlf
  3. git config --global core.autocrlf true
  4. git config --global core.compression 0
  5. git config --global http.postBuffer 1048576000
  6. If on Windows add the following settings, as well.
    • Tell Windows to enable long file paths system-wide
      • 2 options
        • If CMD or Powershell:
          • reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
        • If Git Bash:
          • cmd.exe /c "reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f"
      • To manually verify.
        • Go to start menu and type 'regedit'
        • Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
        • Right click on LongPathsEnabled. It should read as the following value, if not, change it to 1.
          • Value data = 1

Troubleshooting if repo "hangs" while cloning

When cloning, if the repo 'hangs' or doesn't download fully, the following are a few things worth trying, roughly in order of which one will most likely fix the problem.

  1. Increase the HTTP post buffer and Disable compression (most common fix). These settings were mentioned in the settings section above. We recommend setting all those listed there:

    git config --global http.postBuffer 1048576000
    git config --global http.compression 0
    

    Then retry the clone.

  2. Try a shallow clone first to see if the repo itself clones at all:

    git clone --recursive --depth 1 https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials.git
    
  3. Clone without --recursive first, then init submodules separately — this isolates whether the problem is the main repo or a submodule:

    git clone https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials.git
    cd Bonsai_Tutorials
    git submodule update --init --recursive
    
  4. Use SSH instead of HTTPS — SSH avoids the HTTP chunked transfer issue entirely.

    git clone git@hub.openingdesign.com:OpeningDesign/Bonsai_Tutorials.git