as the configuration process requires frequentSSHConnect to the development server to execute commands andSCPcommand to copy files to the server such as dependenciesSSHthe operation of the connection. So, configure the local environment with the serverSSHPassword-free connection can effectively improve productivity. since I have already generated the public key, I just need to copy the existing public key to the server. Recommended UseSsh-copy-idcommand, simple and not error-prone. Manual copy and append the end of public key file, it is easy because of operation problem, cause the public key is not recognized correctly.
Note: If you have not generated a public key, you can generate the public key through the ssh-keygen command. Go to the default configuration.
on my Mac, it's not even installed .Ssh-copy-idcommand. ThroughBrew command to install.
brew install ssh-copy-id
then copy the public key to the specified host
ssh-copy-id [email protected]
where [email protected] is changed to the server you need to accessUser name @ip。 Enter the password once as prompted. After success, all SSH-based commands you only need to passUser name @ipYou can access the server directly.
Password-free SSH login under MacOS