7

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

现在我已经在 Linux(CentOS 6.4)上克隆了我的 repo。一切都设置好了。我更改了一些文件。然后我使用git addgit 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 服务附近。有没有人遇到过这种情况?应该做什么?

在遵循这个答案之后(哪种工作我得到了以下错误)

[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

任何建议表示赞赏。

4

3 回答 3

3

您提到的答案建议将网址从 https 更改为 ssh 。

这只有在你有一个~/.ssh/id_rsaand时才有效~/.ssh/id_rsa.pub,后者(公钥)发布在你的GitHub ssh keys中。

检查您的Egit ssh 配置

http://wiki.eclipse.org/images/8/87/Egit-0.6-003-SshPreferences.png

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

于 2013-11-01T07:58:40.760 回答
1

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

所以首先阅读远程网址:

$ 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 的答案。

于 2014-12-08T16:37:47.690 回答
0

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


错误信息:

错误:请求的 URL 返回错误:403 Forbidden while access https://github.com/bhanurhce/rhel6-examppleserver.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

一切都会正常工作。希望能帮助到你..

谢谢!!

于 2014-08-22T08:48:19.550 回答