I get an issue using
sudo git pull origin master
****:/var/www/****$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQ****4rZZwQjt0VmJdb8zGQwcNMsYAZTCssjNw1UQZqTSUZRy8uK76W9h9kXsVgggAf1EgUKaxaKFFMF50TtugkdsSIGq4/ze9vYDrEVy4rc4aOTPuBNI9X01JRbvUdRtOajmC8WEq5NdLUwXCtg/Cga2uZ ****
****:/var/www/****$ sudo git pull origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
You need to configure and register a ssh (public and private) key in the $HOME (~) of the user which will execute
git pull origin master
If you want to use root (which is not ideal), then the
id_rsa) should be in
/root/.ssh (with the right permissions)
As [Martin Nyolt2 adds in the comments, follow the GitLab documentation about ssh, especially the section "Tip: Non-default OpenSSH key file names or locations".