Configuring ssh git
Generate a personal account / mailbox sshkey
ssh-keygen -t rsa -C "[email protected]" -f ~/.ssh/XXX-rsa
This command will prompt password is complete, no need to set, directly enter
in ~ / .ssh / directory will generate XXX-rsa and XXX-rsa.pub private and public keys. We will paste the contents XXX-rsa.pub the company gitlab (or gitHub) server SSH-key configuration
personal recommendations rsa generated individually named best not to use the default name, because there may sshkey may be used in a multi place, we believe it might be overwritten then lead to git dysfunction
Add the generated private key
ssh-add ~/.ssh/XXX-rsa
If you are prompted "Could not open a connection to your authentication agent" when executing ssh-add, you can first execute the command
# 可以通过 ssh-add -l 来确私钥列表
$ ssh-add -l
# 可以通过 ssh-add -D 来清空私钥列表
$ ssh-add -D