Adding SSH Keys to remote servers

2019-08-28 17:41发布

问题:

I would like to know what people would suggest as a good way to add a deployment key to a remote server, so that it may checkout a private git repo.

I've been trying to deploy an application with Capistrano but keep getting failures with the SSH keys I believe when attempting to checkout the repository the application is linked to.

I have tried Agent Forwarding but I think I might be better just adding a deployment key to each remote server and then adding this key to the repository.

How best would I go about doing this? I'm looking for a few simple commands to run off against each remote server.

回答1:

I think yo want to copy the users' public keys to the server and then add'em to the ssh, right?

To do that you need to do the following:

Copy keys to server

copy from my machine to a remote machine:

scp key_name.pub git@serverIP:key_name.pub

Then cat it to the authorized_keys file

cat key_name.pub >> .ssh/authorized_keys


标签: git ssh ssh-keys