致命:无法连接到github.com:github.com [0:140.82.121.4]:errno =未知错误

发布于 2025-02-04 11:46:56 字数 493 浏览 2 评论 0原文

我的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:

Git push error

I discovered that I'm working with an SSH URL:

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:
example

I tried many options that I thought were solutions such as manually configuration of config file but nothing works.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

月寒剑心 2025-02-11 11:46:57

要使用gitssh,需要使用不同的URL语法,并使用git@< url>作为url。
根据您的屏幕截图,

[email protected]:ahlemtbini/blog_web.git

以下命令更改

git remote set-url origin [email protected]:ahlemtbini/blog_web.git

如果您使用github,我可以使用 URL。 /code> -button在github - 该存储库的第一个页面。 在此处提供更多信息

以获取更多信息以获取更多信息关于git使用的协议,请阅读有关的页面GIT服务器协议

To use git with ssh, a different url syntax is needed, with git@<url> as url.
According to your screenshot, the url should most likely look like this

[email protected]:ahlemtbini/blog_web.git

You can change it with the following command

git remote set-url origin [email protected]:ahlemtbini/blog_web.git

If you are using github, i recommend you to always use the url's listed under the code-button at the github-page of that repository. More information here

For more information about protocols used by git, read the page about git server protocols.

咿呀咿呀哟 2025-02-11 11:46:57

因此,我认为这里有几件事:

  1. 您的第一个屏幕截图中的错误似乎是由于使用plain git(//协议)将存储库克隆而成而引起的。 t进行任何类型的身份验证/授权。意味着您可以git拉,但您将无法git push

  2. 如果要更新您的git配置以自动使用https在按下时,可以将类似的内容添加到gitconfig:

[url "https://github.com/"]
    pushInsteadOf = git://github.com/
  1. 另外使用SSH代替git://https://协议(并将公共密钥上传到您的GH帐户),您可以添加
[url "[email protected]:"]
    pushInsteadOf = git://github.com/
    pushInsteadOf = https://github.com/

So there's a few things going on here I think:

  1. 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 can git pull but you won't be able to git push.

  2. If you want to update your git config to automatically use https when pushing, you can add something like this to your gitconfig:

[url "https://github.com/"]
    pushInsteadOf = git://github.com/
  1. Alternatively if you want to use SSH instead of git:// or https:// protocol (and have your public key uploaded to your GH account) you can add
[url "[email protected]:"]
    pushInsteadOf = git://github.com/
    pushInsteadOf = https://github.com/

ゃ懵逼小萝莉 2025-02-11 11:46:57

在运行git子模块更新时,我遇到了此错误 - init

我通过将所有git://子模块更改为https:// subsodules .gitmodules file。

然后,我跑了

git submodule sync

,我的子模块更新正常工作。

I had this error while running git submodule update --init.

I fixed the problem by changing all my git:// submodules to https:// submodules in the .gitmodules file.

Then I ran

git submodule sync

After that my submodule update worked properly.

拥抱影子 2025-02-11 11:46:57

就我的案例而言,我发现我的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".

无力看清 2025-02-11 11:46:56

发生此错误是因为您的 git端口受到限制

您可以使用以下命令将其修复:

git config --global url.https://github.com/.insteadOf git://github.com/

通过在全球上执行此操作,它将修复其他问题,其中旧存储库或其他方案可能使用git,而不是https git://端口/协议现在可能不起作用。

This error occurred because your git port is restricted.

You can get it fixed with the following command:

git config --global url.https://github.com/.insteadOf git://github.com/

By doing this globally it will also repair other issues where perhaps old repositories or other scenarios may be using git instead of https when the git:// port/protocol may not be functional now vs earlier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文