【问题标题】:error: The requested URL returned error: 403 Forbidden while accessing错误:请求的 URL 返回错误:403 Forbidden while access
【发布时间】:2013-11-12 09:41:05
【问题描述】:

我有一个 git repository 。我在 Windows 中有一个 GUI 客户端,在 Eclipse ADT 中有一个 EGit。通常我在 Eclipse ADT 中编辑并使用 GUI 客户端更新 Github 存储库。首先我提交(它创建一个缓冲区),然后当我同步它时将它上传到我的实际仓库。

现在我已经在 Linux(CentOS 6.4) 上克隆了我的 repo。一切都设置好了。我更改了一些文件。然后我使用了git add 和git commit -m "message" -a 命令,它运行良好。但是我实际的 github 存储库没有更新。经过一番谷歌搜索后,我发现我们必须明确提供git push 命令。之后我得到了

[aniket@localhost Android]$ git push
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/aniket91/Android.git/info/refs

fatal: HTTP request failed

出了什么问题?没有防火墙或代理,我在 iptables 服务附近。有没有人遇到过这种情况?应该怎么做?

在关注this 回答后(哪种工作我得到以下错误)

[aniket@localhost Android]$ git push origin master
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

欢迎提出任何建议。

【问题讨论】:

    标签: android git github


    【解决方案1】:

    answer you mention 建议将 URL 从 https 更改为 ssh。

    这只有在您拥有~/.ssh/id_rsa 和~/.ssh/id_rsa.pub 时才有效,后者(公钥)发布在您的GitHub ssh keys 中。

    检查您的Egit ssh configuration。

    有关如何生成 SSH 密钥并将其设置在您的 GitHub 设置中的分步过程here 是链接。

    【讨论】:

    【解决方案2】:

    我遇到了同样的问题,原因是我在我的 linux 机器下使用 https git 访问。拉动正常,而推动以错误结束。解决方案是切换到 ssh 访问,例如:

    所以先读取远程url:

    $ git config --get remote.origin.url
    
    https://github.com/yourname/project.git
    

    如果您看到 https 则将其更改为 ssh,从您的 github 项目 www 复制正确的 url,然后调用:

    $ git remote set-url origin git@github.com:yourname/project.git
    

    您可能仍需要将 .ssh 公钥放入(并且可能还生成)github。为此,请查看 VonC 的答案。

    【讨论】:

      【解决方案3】:

      所以我在使用 git 将内容推送到存储库时遇到了同样的问题。


      错误信息:

      错误:请求的 URL 返回错误:403 Forbidden while access https://github.com/bhanurhce/rhel6-exapmpleserver.git/info/refs

      致命:HTTP 请求失败


      为我解决问题:

      此错误主要是由于 git hub 中本地计算机的登录凭据造成的。 您必须提供github的用户名和密码

      添加用户名:$ git config --global user.name "bhanurhce" 用户名应该是github的用户帐号。

      确认用户名:$ git config user.name

      一旦你尝试推送,它就会要求输入密码:

      $ git push -u origin master
      密码:(提供你的github密码。)

      问题将得到解决。

      即使您仍然收到 askpass 错误:

      错误信息: [root@virtual-master git]# git push -u origin master

      (gnome-ssh-askpass:47356): Gtk-WARNING **: 无法打开显示:

      那就直接用命令解决吧:$ unset SSH_ASKPASS

      一切都会好起来的。希望对你有帮助。。

      谢谢!!

      【讨论】:

        猜你喜欢
        • 2016-10-25
        • 1970-01-01
        • 2020-03-12
        • 2022-07-31
        • 1970-01-01
        • 2022-10-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多