I am running gitlab 15.7. I am the owner of a Project called scripts. When I attempt to clone it, it fails as such:
`root@ansible:~# git clone @192.168.x.x:/scripts.git
Cloning into ‘scripts’… @192.168.x.x’s password:
fatal: ‘/scripts.git’ does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.`
I am really not sure where to go from here.
I actually had the user specified, but using the code tag it must have removed the username part.
I’ve added my public key, and am getting the same error message.
Shouldn’t there also be a group name or user namespace between the IP/hostname and the scripts.git? As usually a repository/project would need to exist in a group or user namespace. Your URL also is missing this. For example, the one I provided from the Gitlab docs, shows :gitlab-org/gitlab.git, whereas yours just shows :scripts.git
[ian@elise ~]$ ssh -T git@gitlab.com
Welcome to GitLab, @iwalker!
That would at least verify whether SSH is 100% correct for git access. My example is for github.com but you’ll get the same response for your own instance.
I personally don’t use SSH, prefer via HTTPS, but either way it should work fine providing all is configured OK.
Do I have to use the git user? The owner of the repo is my user.
Here’s what I get when I run that ssh command with my user account:
`…
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-135-generic x86_64)
Yes you do, because the git user is tied with Gitlab. It then finds your particular user by the ssh key within Gitlab itself. That’s how it works. If you attempt to use ssh with your username, SSH will attempt to find that user configured in /etc/passwd on the Gitlab server - which won’t exist, and even if it did, it isn’t connected to Gitlab and so will end up logging into the Linux server itself.
That is why you see the welcome to Ubuntu message because you have connected to the Linux server and not to Gitlab via the git user. You should be using the git user, exactly how it is explained in Gitlab SSH docs that I linked.