致命:无法连接到github.com:github.com [0:140.82.121.4]:errno =未知错误
我的git帐户有问题。 都会收到以下错误:
每当我执行git push
时,我 我正在使用ssh url:
我尝试使用以下命令使用以下命令切换回https url:
git config --global url.https://github.com/.insteadOf git://github.com/
git config --global url."https://".insteadOf git://
但是,但是,它似乎没有任何改变:
我尝试了许多我认为是解决方案的选项,例如配置文件的手动配置,但无效。
I'm having a problem with my Git account. Every time I execute git push
, I get the following error:
I discovered that I'm working with an SSH URL:
I tried switching back to an HTTPS URL using the following commands:
git config --global url.https://github.com/.insteadOf git://github.com/
git config --global url."https://".insteadOf git://
However, it doesn't seem to change anything:
I tried many options that I thought were solutions such as manually configuration of config file but nothing works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
要使用
git
与ssh
,需要使用不同的URL语法,并使用git@< url>
作为url。根据您的屏幕截图,
以下命令更改
如果您使用
github
,我可以使用 URL。 /code> -button在github
- 该存储库的第一个页面。 在此处提供更多信息以获取更多信息以获取更多信息关于git使用的协议,请阅读有关的页面GIT服务器协议。
To use
git
withssh
, a different url syntax is needed, withgit@<url>
as url.According to your screenshot, the url should most likely look like this
You can change it with the following command
If you are using
github
, i recommend you to always use the url's listed under thecode
-button at thegithub
-page of that repository. More information hereFor more information about protocols used by git, read the page about git server protocols.
因此,我认为这里有几件事:
您的第一个屏幕截图中的错误似乎是由于使用plain
git(//
协议)将存储库克隆而成而引起的。 t进行任何类型的身份验证/授权。意味着您可以git拉
,但您将无法git push
。如果要更新您的git配置以自动使用
https
在按下时,可以将类似的内容添加到gitconfig:git://
或https://
协议(并将公共密钥上传到您的GH帐户),您可以添加So there's a few things going on here I think:
The error from your first screen shot looks like it may be caused by having cloned the repository using the plain
git://
protocol which doesn't do any type of authentication/authorization. Meaning you cangit pull
but you won't be able togit push
.If you want to update your git config to automatically use
https
when pushing, you can add something like this to your gitconfig:git://
orhttps://
protocol (and have your public key uploaded to your GH account) you can add在运行
git子模块更新时,我遇到了此错误 - init
。我通过将所有
git://
子模块更改为https://
subsodules.gitmodules
file。然后,我跑了
,我的子模块更新正常工作。
I had this error while running
git submodule update --init
.I fixed the problem by changing all my
git://
submodules tohttps://
submodules in the.gitmodules
file.Then I ran
After that my submodule update worked properly.
就我的案例而言,我发现我的Flutter Project试图从pubspec.yaml上的URL获取以下格式的依赖性:“ git:github.com/repository” ...为了解决它,我只需要更改“”。 git”为“ https”。
In my case I figured out my flutter project was trying to fetch a dependency from an URL on the pubspec.yaml with the following format: "git:github.com/repository"...To fix it I just had to change the "git" for "https".
发生此错误是因为您的 git端口受到限制。
您可以使用以下命令将其修复:
通过在全球上执行此操作,它将修复其他问题,其中旧存储库或其他方案可能使用
git
,而不是https
git://
端口/协议现在可能不起作用。This error occurred because your git port is restricted.
You can get it fixed with the following command:
By doing this globally it will also repair other issues where perhaps old repositories or other scenarios may be using
git
instead ofhttps
when thegit://
port/protocol may not be functional now vs earlier.