【问题标题】:git push origin master> fatal: HTTP request failedgit push origin master> 致命:HTTP 请求失败
【发布时间】:2012-08-15 16:17:22
【问题描述】:

当我执行 Git 推送时,我收到以下错误消息 -

  Username: 
  Password: 
  error: The requested URL returned error: 403 while accessing https://github.com/Selvam-T/hw4_rottenpotatoes.git/info/refs

我的Git克隆只读地址是https://github.com/Selvam-T/hw4_rottenpotatoes.git

我按照建议将 repo 配置更改为 ssh 方式,如下所示 -

git remote set-url origin ssh://git@github.com/Selvam-T/hw4_rottenpotatoes.git

然后我得到的错误信息,当我做“git push origin master”时,是这样的-

  ssh: Could not resolve hostname github.com:Selvam-T: Name or service not known
  fatal: The remote end hung up unexpectedly

如何解决其中一个通信问题?

【问题讨论】:

    标签: git-push


    【解决方案1】:

    可以使用https或ssh地址推送。

    但对于 https,您需要一个 ~/.netrc(或 Windows 上的 %HOME%\_netrc,假设您已经定义了一个 HOME 环境变量),其中包含您的 GitHub 凭据。
    有关示例,请参见“Syncing with github”或“need github without username and password”。

    对于 ssh,您需要 ~/.ssh 中的私钥/公钥,并将公钥发布到您的存储库和 ~/.ssh/config 文件。
    请参阅“Why doesn't my SSH key work for connecting to github?”了解更多信息。

    【讨论】:

      猜你喜欢
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-21
      • 1970-01-01
      • 2021-04-13
      • 1970-01-01
      • 2012-09-09
      相关资源
      最近更新 更多