|
| 1 | +--- |
| 2 | +title: Git |
| 3 | +description: Learn how to install Git on your system to get started with version control |
| 4 | +--- |
| 5 | + |
| 6 | +Git is a distributed version control system that tracks changes in your files and enables collaboration with others. You'll need Git installed to work with most development projects. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +Before installing Git, ensure you have administrative privileges on your system. |
| 11 | + |
| 12 | +## Installation by operating system |
| 13 | + |
| 14 | +<Tabs> |
| 15 | + <Tab title="Windows"> |
| 16 | + ### Option 1: Download from Git website |
| 17 | + |
| 18 | + 1. Visit [git-scm.com](https://git-scm.com/download/win) |
| 19 | + 2. Download the latest version for Windows |
| 20 | + 3. Run the installer and follow the setup wizard |
| 21 | + 4. Accept the default settings unless you have specific requirements |
| 22 | + |
| 23 | + ### Option 2: Using package managers |
| 24 | + |
| 25 | + **Using Chocolatey:** |
| 26 | + ```bash |
| 27 | + choco install git |
| 28 | + ``` |
| 29 | + |
| 30 | + **Using Winget:** |
| 31 | + ```bash |
| 32 | + winget install --id Git.Git -e --source winget |
| 33 | + ``` |
| 34 | + |
| 35 | + ### Verify installation |
| 36 | + ```bash |
| 37 | + git --version |
| 38 | + ``` |
| 39 | + </Tab> |
| 40 | + |
| 41 | + <Tab title="macOS"> |
| 42 | + ### Option 1: Using Homebrew (recommended) |
| 43 | + |
| 44 | + If you have Homebrew installed: |
| 45 | + ```bash |
| 46 | + brew install git |
| 47 | + ``` |
| 48 | + |
| 49 | + ### Option 2: Download from Git website |
| 50 | + |
| 51 | + 1. Visit [git-scm.com](https://git-scm.com/download/mac) |
| 52 | + 2. Download the latest version for macOS |
| 53 | + 3. Open the downloaded `.dmg` file and follow the installation instructions |
| 54 | + |
| 55 | + ### Option 3: Using Xcode Command Line Tools |
| 56 | + |
| 57 | + Git comes bundled with Xcode Command Line Tools: |
| 58 | + ```bash |
| 59 | + xcode-select --install |
| 60 | + ``` |
| 61 | + |
| 62 | + ### Verify installation |
| 63 | + ```bash |
| 64 | + git --version |
| 65 | + ``` |
| 66 | + </Tab> |
| 67 | + |
| 68 | + <Tab title="Linux"> |
| 69 | + ### Ubuntu/Debian |
| 70 | + ```bash |
| 71 | + sudo apt update |
| 72 | + sudo apt install git |
| 73 | + ``` |
| 74 | + |
| 75 | + ### CentOS/RHEL/Fedora |
| 76 | + **For CentOS/RHEL:** |
| 77 | + ```bash |
| 78 | + sudo yum install git |
| 79 | + ``` |
| 80 | + |
| 81 | + **For Fedora:** |
| 82 | + ```bash |
| 83 | + sudo dnf install git |
| 84 | + ``` |
| 85 | + |
| 86 | + ### Arch Linux |
| 87 | + ```bash |
| 88 | + sudo pacman -S git |
| 89 | + ``` |
| 90 | + |
| 91 | + ### Verify installation |
| 92 | + ```bash |
| 93 | + git --version |
| 94 | + ``` |
| 95 | + </Tab> |
| 96 | +</Tabs> |
| 97 | + |
| 98 | +## Initial configuration |
| 99 | + |
| 100 | +After installing Git, configure your identity: |
| 101 | + |
| 102 | +```bash |
| 103 | +git config --global user.name "Your Name" |
| 104 | +git config --global user.email "[email protected]" |
| 105 | +``` |
| 106 | + |
| 107 | +You can verify your configuration: |
| 108 | +```bash |
| 109 | +git config --list |
| 110 | +``` |
| 111 | + |
| 112 | +## Next steps |
| 113 | + |
| 114 | +With Git installed, you can now: |
| 115 | +- Clone repositories from GitHub, GitLab, or other Git hosting services |
| 116 | +- Initialize new Git repositories with `git init` |
| 117 | +- Start tracking changes in your projects |
| 118 | +- Collaborate with others using version control |
| 119 | + |
| 120 | +For more advanced Git usage and concepts, check out the [Git documentation](https://git-scm.com/doc). |
0 commit comments