【问题标题】:Ubuntu Can't Locate Git Repositories After Upgrade升级后 Ubuntu 无法找到 Git 存储库
【发布时间】:2015-09-14 23:23:24
【问题描述】:

在我将 Ubuntu 从 14.04 升级到 14.10(现在升级到 15.04)后,我无法使用 git 协议连接到 GitHub 和 Bitbucket,https 和 ssh 工作正常:

ssh -T git@github.com Hi Arbolista! You've successfully authenticated, but GitHub does not provide shell access.

太棒了。

git remote add github git@github.com:arbolista/my_repo.git git remote -v github https://github.arbolista/my_repo.git (fetch) github https://github.arbolista/my_repo.git (push) git pull github master fatal: repository 'https://github.arbolista/my_repo.git/' not found

不是那么棒,让我发疯。我重新安装了 git(现在是最新的 2.5.2)和我的 ssh 密钥无济于事 - 我完全迷失了这一点。

我还确保 git 端口没有防火墙:

sudo ufw status verbose Status: inactive

我的 ~/.ssh/config 看起来像这样(从它工作时不变):

Host github.com-arbolista HostName github.com User git IdentityFile ~/.ssh/id_rsa

【问题讨论】:

  • 从输出中可以明显看出,实际上是 https 访问失败。

标签: git ubuntu ssh


【解决方案1】:

打开.git/config。应该有一个名为[remote "github"]url=https://github.arbolista/my_repo.git 的部分

url 更改为git@github.com:arbolista/my_repo.git

【讨论】:

  • 感谢您的洞察力。问题出在我的~/.gitconfig 文件上。不知道为什么这会在升级过程中发生变化。不知何故添加了[url "https://"] insteadOf = git://,这将解释git remote -v 的输出在我添加“git”远程后立即显示“https”而不是“git”。 Https 连接很好,但是那个配置在连接的时候明显是混淆了 git。
  • @EricH。 Git 只会做你告诉它做的事情。所以,不,它没有混淆。您可以在发布的输出中清楚地看到它。 github remote 已经定义了 url https://github.arbolista/my_repo.git,这当然不是有效的 github URL。
  • 哈哈,我不是在责怪 git - 我的设置无效。我只是不知道该设置是如何到达那里的 - 要么是 Ubuntu 升级中的一些超出范围,要么是我在升级之前无意中所做的。
猜你喜欢
  • 2014-09-10
  • 1970-01-01
  • 1970-01-01
  • 2020-10-05
  • 2020-10-22
  • 2020-02-20
  • 2017-02-11
  • 1970-01-01
  • 2013-10-27
相关资源
最近更新 更多