git pull
or git clone
, are automatized deployments..ssh
directory of the user in the server, so start a SSH session to your server and type the following command:/home/vagrant/.ssh
, if the output of the command shows a string that starts with ssh-rsa, then you already have an SSH Key that you can use to add to your repository, so you can skip to the step 2. If instead, you get the output : cat: ~/.ssh/id_rsa.pub: No such file or directory, then you will need to create an SSH Key first. You can create a SSH Key in Ubuntu via SSH with the following command (navigate to the .ssh directory first and type):id_rsa
and id_rsa.pub
file in our .ssh
directory. This key works as a 'pass' that allows to clone/pull your project in the current server, till this point it doesn't do anything, so you will need to follow the other steps.ssh-agent
is enabled by running the following command:~/.ssh/config
file. If the file doesn't exist, you can create it:https://gitlab.com/<username>/<repository-name>/settings/repository
. The menu to add a new deploy key looks like this:id_rsa.pub
file, provide a title and decide wheter the server can be used to push changes as well or not (normally unchecked as it is production). Once the key is added in your repository, you should be able now to clone/pull your repository in the deployment server.