Gitlab can't clone repository even though ssh works

喜夏-厌秋 提交于 2019-12-09 05:16:58

问题


As the title states, I can't clone a repository from a Gitlab 6 server even though the ssh seems to work.

When trying to clone, it looks like this:

git clone ssh://git@domain.de:1337/project/repository.git
Cloning into 'repository'...
Access denied.
fatal: Could not read from remote repository.

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

In the project, I have the role of "developer" which should have the rights to clone a repository?

I also checked if my SSH public key is working

ssh git@domain.de -p 1337 -T
Welcome to GitLab, Anonymous!

More irritating to me is that for a friend of mine seems everything to work fine.

Edit: The main indicator for the problem stated here is the greeting from the SSH Test. In an working enviroment it should be greeting you with your name instead Anonymous!


回答1:


Try the scp-like syntax:

git clone ssh://git@domain.de:1337:project/repository.git

That forces the use of ~/.ssh/config actually, which means the url can be simplified to gitlab:project/repositoriy.git.

But it turned out to be an ssh key issue in the gitlab server ~gitlab/.ssh/authorized_keys (a bit like in issue 4730).
The OP Gelix confirms in the comments:

I removed my key from Gitlab, manually from authorized_keys, readded it on Gitlab. Everything fine now.
Message with SSH Test is now also Welcome to GitLab, Felix *****!

(instead of Welcome to GitLab, Anonymous!)



来源:https://stackoverflow.com/questions/33837103/gitlab-cant-clone-repository-even-though-ssh-works

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!