Git Bash:远程错误:无法推送到git://github.com/

32

请帮我,我该如何解决这个错误?

$git push origin dev
fatal: remote error:
 You can't push to git://github.com//name_of_repo.git
 Use https:://github.com//name_of_repo.git

通过使用GitHub向您提供的其中一个仓库URL(可以是HTTPS或SSH)在仓库页面上,而不是在第一次获取“git://”URL的位置。 - ThiefMaster
顺便说一句,不要发布错误的截图,而是将它们作为文本发布。 - ThiefMaster
我使用了命令 - $git clone git://github.com//name_of_repo.git。 - Yuriy Lisovskiy
1
你从哪里得到这个URL的?GitHub显示两个选项(HTTPS/SSH)来克隆,但都没有使用git:// URL。 - ThiefMaster
1
@ThiefMaster GitHub 通过 SSH 的“命令行说明”提供有问题的 git:// URL 来合并拉取请求。很奇怪... - ntc2
3个回答

54

请使用HTTPS或SSH URL,而不是git://github.com/user/repo.git。可以使用以下其中一个:

  • https://github.com/user/repo.git
  • git@github.com:user/repo.git

您可以像这样更改克隆中的URL:

git remote set-url origin <THE-URL-HERE>

1
那么,我怎样才能将 git://github.com/user/repo.git 替换为 https://github.com/user/repo.git - Yuriy Lisovskiy
将其添加到我的答案中。 - ThiefMaster

13

在 Mac OS X 10.6.8 上尝试使用 https 会导致以下错误消息:error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version while accessing https://...............git,因此感谢您提供的解决方案。 - NuclearPeon
1
当你使用 git:// 时,它也不起作用,你必须将其设置为 git@ - NuclearPeon

7

Github给出的错误信息有些误导人,它建议使用https://,即使用户可以通过ssh密钥更轻松地进行身份验证。相比之下,使用ssh的(希望更优秀的)替代方法如下:

git remote set-url origin ssh://git@github.com/user/repo.git

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接