| <- Previous: Introduction | Next: Configure Your Git Identity -> |
|---|
Install Git on your machine and set main as the default branch name for new repositories.
- install Git on your operating system
- confirm that your terminal can run
git - explain what
init.defaultBranchcontrols
- Git is a local command-line tool. It must be installed before you can use it.
git initcreates a new repository on your machine.init.defaultBranchsets the default branch name for future repositories you initialize locally.
Choose the instructions for your operating system.
- Go to Git for Windows.
- Download the installer and complete the installation with the default settings.
Open Terminal and run:
git --versionIf Git is not installed, macOS usually prompts you to install the Command Line Tools.
On Debian or Ubuntu:
sudo apt update
sudo apt install git -yOn Fedora or RHEL:
sudo dnf install git -yRun this once:
git config --global init.defaultBranch mainThis affects repositories you create later with git init.
Open a new terminal session and run:
git --version
git config --global --get init.defaultBranchgit --versionprints an installed version instead of an error.git config --global --get init.defaultBranchprintsmain.- You can explain that this setting affects new repositories, not every existing repository.
| <- Previous: Introduction | Next: Configure Your Git Identity -> |
|---|