【问题标题】:Multiple error when trying to push to remote repository尝试推送到远程存储库时出现多个错误
【发布时间】:2021-08-26 19:53:21
【问题描述】:

在编写了一个 javascript 项目后,我写了

git push -u origin main

但是它给了我回报:

ssh: connect to host github.com port 22: Undefined error: 0
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

pic to describe it

我该怎么办?我一般是 git/github 的新手,一直在尝试解决它,但运气不好。提前谢谢大家的回答

【问题讨论】:

  • 这些是 SSH 的说明。您是否已将 SSH 密钥上传到 GitHub? docs.github.com/en/github/authenticating-to-github/…
  • 是的,谢谢你成功了!
  • 你是否从 git 仓库添加了 remote-url ?在git push之前,添加带有git remote add origin https://github.com/user-name/repo-name.git的url。
  • 旁注:那个错误信息,Undefined error: 0 很糟糕。显然 Mac 版本的 ssh 需要一些工作。 (您运行的是哪个 macOS?)

标签: git github git-remote repo


【解决方案1】:

通过 SSH 连接到 GitHub 时,请确保您已将 SSH 密钥上传到 GitHub。这篇文章解释了这个过程。

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-28
    • 2012-08-09
    • 2012-08-11
    • 2021-12-22
    • 2013-02-14
    • 2011-10-02
    • 2011-04-29
    • 2016-03-18
    相关资源
    最近更新 更多