Configure gitlab on Mac

1. Install git
git --version
  • Surprisingly, git is already installed on my mac!
    Insert picture description here
  • 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.
  • Configure global user information
git config --global user.name "username" # 设置gitlab的用户名
git config --global user.email "[email protected]" # 设置gitlab的邮箱
2. Configure ssh public key
  • 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

Insert picture description here

  • 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.
ssh-keygen -t rsa -C "[email protected]"

Insert picture description here

  • View the public key: Enter the following command to get the specific content of the public key, which ssh-rsastarts with.
cat ~/.ssh/id_rsa.pub
  • Copy the above content and paste it into the input box of gitlab avatar —> settings —> ssh key.
3. Download of the project
  • Check the clone link of the project ssh, enter the following command to clone the project to the local
git clone [email protected]

Guess you like

Origin blog.csdn.net/u014454538/article/details/107758338