Skip to main content

InstallGit

AndyBinOriginalAbout 1 min

Preface

Git is a full platform software. Please select the corresponding system when downloading and installing.

Install git on Windows

Go to the official website to download the corresponding client: https://git-scm.com/downloadsopen in new window

After the download is completed, you can install it by default (by default, git will be added to the system environment variable).

Install git on Mac

If you are using MacOS for development, there are two ways to install Git.

The first method is to install homebrew and then install Git through homebrew. Please refer to the homebrew documentation for specific methods: https://brew.sh/index_zh-cnopen in new window

The second method is simpler and recommended. You can directly install Xcode from AppStore. Xcode integrates Git, but it is not installed by default. You need to run Xcode, select the menu Xcode ->Preferences, find Downloads in the pop-up window, select Command Line Tools, and click `Install to complete the installation.

Install git on linux

First, try to enter git in the terminal to check whether it has been installed. If the following content appears, it means that git has not been installed

$ git
The program 'git' is currently not installed. You can install it by typing:
sudo apt-get install git

Ubuntu usage

sudo apt-get install git

CentOS usage:

sudo yum install git -y

Other versions of Linux require source code compilation and installation.
Go to the official website to download the latest version of the compressed package: https://github.com/git/git/releasesopen in new window
After decompression, execute the following command:

git clone https://github.com/git/git.git
./configure
make
sudo make install

Config

After installing git, you need to configure it before it can be used normally. Open the git bash and execute:

git config --global user.name "Your Name"
git config --global user.email "email@example.com"

The name and email in the above command are the name and email used when you register GitHub

Tips

Note the --global parameter of the git config command. If you use this parameter, it means that all Git repositories on your machine will use this configuration. Of course, you can also specify different user names and email addresses for a repository.

Last update:
Contributors: rumosky
Comments
  • Latest
  • Oldest
  • Hottest