Git“似乎不是git仓库” IP和端口而不是域? [英] Git "does not appear to be a git repository" ip and port instead of domain?

查看:260
本文介绍了Git“似乎不是git仓库” IP和端口而不是域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的第一个Git仓库提交给一个gitlab实例,我在debian-VM上设置了这个实例。一切都将通过本地网络进行。

  mkdir test 
cd test
git在gitlab中显示以下命令。 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

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

  git@10.200.3.248的密码:
致命:'' 1337:Matt / test.git'似乎不是Git存储库
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

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



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

解决方案

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



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



对我而言,Git-url是:

  git@10.200.3.248:存储库/ Matt / test.git 

我的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 in path ..
https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#could -not-read-from-remote-repository



也许与rsa-keys有关,但我不明白它是如何组合在一起的。 p>

Edit4 :(问题似乎已解决)
我的rsa键没问题。问题是我配置了我的sshd_config只允许某个用户进行ssh-login。我只是将Git添加到允许的用户列表中 AllowUsers mylogin git



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



我想通了:



通过终端以root身份登录:

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

====调试模式===

然后在Git Bash中:

  ssh -Tv git@gitlab.example .com 

然后,以sshd在调试模式下运行的终端发出Git不被允许的错误登录因为AllowUsers ...



不要忘记在之后启动您的ssh服务:

  service ssh start 


I'm trying to commit my first Git repository to a gitlab instance, which I've set up on a debian-VM. Everything is going to happen via local network. The following commands are shown in gitlab after creating a new repo.

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

After entering git push -u origin master this happens:

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.

Could the problem be the port on which Git is running at? Gitlab is accessible through port 617 so I'am able to reach the GUI via http://xxx.xxx.xxx.xxx:617/Matt/test

The password I've entered seems to be correct, because a wrong password will end up in a "permission denied" message. OT: I don't know why I've to enter a passwd, because I've generated and added ssh-keys, as described in gitlab, but that's an other problem.

解决方案

I've solved my problem. The given port 1337 wasn't the problem, although it was wrong too, because ssh does not seem to be able to handle a port in url:

Using a remote repository with non-standard port

The Git-url which worked for me was:

git@10.200.3.248:repositories/Matt/test.git

My Git user home dir is located in /home/git/ and the repositories are stored in /home/git/repositories so i had to add repositories to my Git-path.

The reason why GitLab told me to use the url git@10.200.3.248:1337:Matt/test.git seems to be a wrong configured Git path in GitLab. I'll try to fix this now.

Edit:

The wrong host was configured in /home/git/gitlab/config/gitlab.yml. The "host" there must be without port... There is an extra option for the port if needed.

Edit3: Still unable to push or fetch my test-repository without repositories in path.. https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#could-not-read-from-remote-repository

Maybe something to do with rsa-keys but I don't understand how this belongs together.

Edit4: (Problem(s) seem to be solved) My rsa-keys were ok. The problem was that I've configured my sshd_config to allow only a certain user for ssh-login. I've simply added Git to the list of allowed users AllowUsers mylogin git

Now I don't have to login via password anymore (You never have to login via password if ssh rsa keys are set up correctly) and the path works without "repositories" as it should. Now I understand, that this is just a normal ssh-connection - I hadn't realized this before..

The way I figured it out:

login via terminal as root:

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

====debugging mode===

Then in Git Bash:

ssh -Tv git@gitlab.example.com

Afterwards the terminal with sshd running in debug mode has thrown an error that Git is not allowed to login because of AllowUsers...

Don't forget to start your ssh service afterwards:

service ssh start

这篇关于Git“似乎不是git仓库” IP和端口而不是域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆