Attempting to git clone results in error - does not exist or incorrect access rights

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.

1 Like

If you are attempting to clone over SSH, then you are missing the git user before your @ symbol:

git clone git@192.168.x.x

you also have to ensure an SSH key has been uploaded to your profile as well.

Some info can be found in the docs on this: Use SSH keys to communicate with GitLab | GitLab

Eg:

1 Like

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.

1 Like

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

1 Like

It seems like more text was removed on here. Here’s what it looks like for me. Sorry about that.
git@my-domain.com:username/scripts.git

1 Like

And your external_url in gitlab.rb is “my-domain.com”? And not something like gitlab.my-domain.com?

Please try cloning over http or https depending on what you have configured, so:

git clone https://my-domain.com/username/scripts.git

and does that ask you for username/password and does it clone OK? If so, then it means you only have a problem with SSH.

1 Like

Huh, strange, it worked, Thank you!
So what problem could I have with SSH?
The domain is gitlab.my-domain.com, but I use the IP to access it instead.

1 Like

If you do a:

ssh -T git@my-server.com

does it give you something like this:

[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.

1 Like

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)

System information as of Sat 07 Jan 2023 11:17:58 AM UTC

`
I don’t see anything saying “welcome to gitlab”.

1 Like

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.

1 Like