First, open the terminal of the mac and enter the following command to check whether git has been installed on your mac.
git --version
Surprisingly, git is already installed on my mac!
For the installation of git, you can check the official website download page of the MacOS version of Git: Download for macOS , personally recommend homebrewto install it.
git has two communication methods: https and ssh, I like to use ssh
First check whether ssh is installed locally. The following output indicates that ssh has been installed.
ssh
Check whether the ssh public key already exists locally. If it appears id_rsaand id_rsa.pubindicates that it already exists, you can skip directly to the step of viewing the public key.
cd ~/.ssh
ls
Public key generation: Enter the following command and when interactive information appears, keep pressing enter until the public key is generated.