Install Homebrew

Open the terminal and enter the following command on the command line

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Copy the code

This command uses the domestic mirror, will also let you choose to use the UNIVERSITY of Science and Technology/Tsinghua/Tencent image directly press 1 to use the university of Science and Technology mirror, confirm the automatic completion

Install Git using Homebrew

The command is simple

brew install git
Copy the code

One way automatic installation

Configure SSH

First generate the current computer SSH secret key, note that the last change to your login email, without quotation marks

Ssh-keygen -t rsa -c {githubCopy the code

After the generation, switch to the following path

cd ~/.ssh
Copy the code

Open the id_rsa.pub file using the vim command (note not id_rsa)

vim id_rsa.pub
Copy the code

Then copy out all the characters in the file, starting with ssh-RSA and ending with login email

Configuration making

Open Github, click on your profile picture in the upper right corner, select Settings, switch to SSH & GPG Keys, select the green New SSH Keys title in the upper right corner, and then copy the rsa key to it and save it

Then you can use SSH to connect to Git