×

注意!页面内容来自https://github.com/git-guides/install-git,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

Skip to content
<> /* Override primer focus outline color for marketing header dropdown links for better contrast */ [data-color-mode="light"] .HeaderMenu-dropdown-link:focus-visible, [data-color-mode="light"] .HeaderMenu-trailing-link a:focus-visible { outline-color: var(--color-accent-fg); }
Install Git illustration

Install Git

How to install Git on any OS

Git can be installed on the most common operating systems like WindowsMacand Linux. In factGit comes installed by default on most Mac and Linux machines!

Checking for Git

To see if you already have Git installedopen up your terminal application.

  • If you're on a Maclook for a command prompt application called "Terminal".
  • If you're on a Windows machineopen the windows command prompt or "Git Bash".

Once you've opened your terminal applicationtype git version. The output will either tell you which version of Git is installedor it will alert you that git is an unknown command. If it's an unknown commandread further and find out how to install Git.

Install Git Using GitHub Desktop

Installing GitHub Desktop will also install the latest version of Git if you don't already have it. With GitHub Desktopyou get a command-line version of Git with a robust GUI. Regardless of if you have Git installed or notGitHub Desktop offers a simple collaboration tool for Git. You can learn more here.

Install Git on Windows

  1. Navigate to the latest Git for Windows installer and download the latest version.
  2. Once the installer has startedfollow the instructions as provided in the Git Setup wizard screen until the installation is complete.
  3. Open the windows command prompt (or Git Bash if you selected not to use the standard Git Windows Command Prompt during the Git installation).
  4. Type git version to verify Git was installed.

Note: git-scm is a popular and recommended resource for downloading Git for Windows. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git included with the recommended command promptGit Bash . The download source is the same Git for Windows installer as referenced in the steps above.

Install Git on Windows through Visual Studio Code

GitHub integration is provided through the GitHub Pull Requests and Issues extension.
To get started with the GitHub in VS Codeyou'll need to create an account and install the GitHub Pull Requests and Issues extension.
Once you've installed the GitHub Pull Requests and Issues extensionyou'll need to sign in. Follow the prompts to authenticate with GitHub and return to VS Code.


Note: You can perform actions likeyou can search for and clone a repository from GitHub using the Git: Clone command in the Command Palette (Ctrl+Shift+P) or by using the Clone Repository button in the Source Control view (available when you have no folder open).
Learn more here


Install Git on Mac

Most versions of MacOS will already have Git installedand you can activate it through the terminal with git version. Howeverif you don't have Git installed for whatever reasonyou can install the latest version of Git using one of several popular methods as listed below:

Install Git From an Installer

  1. Navigate to the latest macOS Git Installer and download the latest version.
  2. Once the installer has startedfollow the instructions as provided until the installation is complete.
  3. Open the command prompt "terminal" and type git version to verify Git was installed.

Note: git-scm is a popular and recommended resource for downloading Git on a Mac. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git. The download source is the same macOS Git Installer as referenced in the steps above.

Install Git from Homebrew

Homebrew is a popular package manager for macOS. If you already have Homebrew installedyou can follow the below steps to install Git:

  1. Open up a terminal window and install Git using the following command: brew install git.
  2. Once the command output has been completedyou can verify the installation by typing: git version.

Install Git on Linux

Fun fact: Git was originally developed to version the Linux operating system! Soit only makes sense that it is easy to configure to run on Linux.

You can install Git on Linux through the package management tool that comes with your distribution.

Debian/Ubuntu

  1. Git packages are available using apt.
  2. It's a good idea to make sure you're running the latest version. To do soNavigate to your command prompt shell and run the following command to make sure everything is up-to-date: sudo apt-get update.
  3. To install Gitrun the following command: sudo apt-get install git-all.
  4. Once the command output has been completedyou can verify the installation by typing: git version.

Fedora

  1. Git packages are available using dnf.
  2. To install Gitnavigate to your command prompt shell and run the following command: sudo dnf install git-all.
  3. Once the command output has been completedyou can verify the installation by typing: git version.

Note: You can download the proper Git versions and read more about how to install on specific Linux systemslike installing Git on Ubuntu or Fedorain git-scm's documentation.

Other Methods of Installing Git

Looking to install Git via the source code? Learn more here.

Contribute to this article on GitHub.

Get started with git and GitHub

Review codemanage projectsand build software alongside 40 million developers.

Sign up for GitHub Sign in