Login to new server as root, then add a deploy user
sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy
Now login as that user
ssh [email protected]
You can temporary enable password authentication
sudo nano /etc/ssh/sshd_config
Find out PasswordAuthentication to yes:
PasswordAuthentication yes
Save file and exit editor. It requires you to restart SSH service:
sudo systemctl restart sshd
Install git
sudo apt-get install git
sudo apt-get install git-core
Make directory .ssh on the remote server and log out
mkdir .ssh
exit
Push your ssh key to the authorized_keys file on the remote server
scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys
Create the RSA Key Pair
ssh-keygen -t rsa
Run git agent
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
Add deployment key for server
ssh -T [email protected]
ssh -T [email protected]