Git"似乎不是一个git存储库"ip和端口而不是域?

mat*_*mat 18 git gitlab

我正在尝试将我的第一个Git存储库提交给gitlab实例,我已经在debian-VM上设置了它.一切都将通过本地网络发生.创建新的repo后,gitlab中会显示以下命令.

mkdir test
cd test
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@10.200.3.248:1337:Matt/test.git
git push -u origin master
Run Code Online (Sandbox Code Playgroud)

进入后git push -u origin master发生这种情况:

git@10.200.3.248's password:
fatal: '1337:Matt/test.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.
Run Code Online (Sandbox Code Playgroud)

问题可能是Git运行的端口吗?Gitlab可通过端口617访问,因此我可以通过http://xxx.xxx.xxx.xxx:617/Matt/test访问GUI

我输入的密码似乎是正确的,因为错误的密码将以"权限被拒绝"消息结束.OT:我不知道为什么要输入passwd,因为我已经生成并添加了ssh-key,如gitlab中所述,但这是另一个问题.

mat*_*mat 20

我已经解决了我的问题.给定端口1337不是问题,虽然它也是错误的,因为ssh似乎无法处理url中的端口:

使用具有非标准端口的远程存储库

为我工作的Git-url是:

git@10.200.3.248:repositories/Matt/test.git
Run Code Online (Sandbox Code Playgroud)

我的Git用户主目录位于,/home/git/并且存储库存储在其中,/home/git/repositories因此我必须将存储库添加到我的Git路径.

GitLab告诉我使用url的原因git@10.200.3.248:1337:Matt/test.git似乎是GitLab中配置错误的Git路径.我现在试着解决这个问题.

编辑:

配置了错误的主机/home/git/gitlab/config/gitlab.yml."主机"必须没有端口......如果需要,端口还有一个额外的选项.

编辑3:仍然无法在没有repositories路径的情况下推送或获取我的测试库... https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#could-not-read-from-remote -repository

也许与rsa-keys有关但我不明白它是如何属于一起的.

编辑4 :(问题似乎得到解决) 我的rsa键是好的.问题是我已经配置了我的sshd_config以仅允许某个用户进行ssh-login.我只是将Git添加到允许的用户列表中AllowUsers mylogin git

现在我不再需要通过密码登录了(如果正确设置了ssh rsa密钥,你就不必通过密码登录)并且路径在没有"存储库"的情况下工作.现在我明白了,这只是一个正常的ssh连接 - 我之前没有意识到这一点.

我想出来的方式:

以root身份登录终端:

service ssh stop #Current SSH-Connection won't be closed..
/usr/sbin/sshd -d

====debugging mode===
Run Code Online (Sandbox Code Playgroud)

然后在Git Bash中:

ssh -Tv git@gitlab.example.com
Run Code Online (Sandbox Code Playgroud)

之后,在调试模式下运行sshd的终端抛出了一个错误,即由于AllowUsers,Git不允许登录...

不要忘记之后开始你的ssh服务:

service ssh start
Run Code Online (Sandbox Code Playgroud)

  • 我不确定你是否应该指定`Matt/test.git`的本地路径:'`repositories`'不应该在这里提到. (2认同)