Can't git clone on local machine

Hello Folks,I have a question about how to work with repositories.

I am running a self hosted GitLab 15.11.I have logged in to the GitLab GUI, created a group repository, and completed basic operations on the GUI. But I can’t clone the project (repository) from my local machine. What could be the cause?

When I clone it, it asks for a password, but even if I enter the password for my Gitlab personal account, I get a message like the one below.

"Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists."

The repository path is the one I copied from the GitLab GUI. Changing the domain name part to “localhost:[PortNum]” or “[IPAddress]:[PortNum]” does not solve the problem.

git@gitlab.example.com:[GroupName]/[RepName].git
http://gitlab.example.com/[GroupName]/[RepName].git

Refer to the document and SSH key setting is completed.
Use SSH keys to communicate with GitLab | GitLab.

Try to SSH into the server to see if there is not problem with the key (usually permissions are too wide on your workstation). Then you can check OpenSSH/auth logs in the GitLab server whats wrong.

1 Like

Thank you for your answer. It said ““Permission denied”” simply because the username was wrong.
*I used the username that was listed as an example in the Gitlab GUI.

After changing the username to the appropriate one, I was able to log in to the machine, but I still can’t recognize the repository. The following message is displayed.

$ git clone [username]@localhost:8080/test/smp.git
Cloning into ‘smp’…
[username]@localhost’s password:
fatal: ‘8080/test/smp.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.

When accessing GitLab GUI from a browser, I entered “localhost:8080” in the URL and was able to access it. Of course, if I change the port number to 8081, I will not be able to access it with a browser, but even if I change the port number to 8081 when git cloned, the error message displayed will not change. Therefore, I think that GitLab cannot be recognized from the command line.

$ git clone [username]@localhost:8081/test/smp.git
Cloning into ‘smp’…
[username]@localhost’s password:
fatal: ‘8081/test/smp.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.

We are still looking for solution ideas. We appreciate your cooperation.

If you are using the SSH URL to clone a repository by default the port is 22.
I suppose in your case port 8080 is for HTTP which is used in case you use the HTTP URL to clone.

1 Like

Thank you for your answer. Changing the SSH port number to 22 didn’t change the message.
If you access with port number 8080 of http, the access to the proxy server will time out. So, I think that SSH access is the most likely to connect now.

I had a problem with my network settings and was able to fix it. Thank you for your cooperation.