- Generate SSH key
$ ssh-keygen -t rsa -C "[email protected]"
- To copy the public key,
you can find the .ssh directory in the user's home directory. There are two files id_rsa and id_rsa.pub in it. These two are the secret key pair of SSH Key. id_rsa is the private key and cannot be leaked out. key, you can tell anyone with confidence.
- Configure the SSH Key
avatar in Gitlab>settings>SSH Keys.
Generally, this step is enough, but sometimes there will be situations where the user name and password are still required to be entered after setting the SSH Key, and the operation in step 4 is required. - configuration
git config --global credential.helper store
Then the operation pull/push will allow you to enter the username and password, and enter it for the first time. The next time you operate pull/push, you don't need to enter the username and password.