问:
我能够通过 HTTPS 身份验证克隆此 repo 的副本。我做了一些提交,并希望将其推送回 GitHub 服务器。在 Windows 7 x64 上使用 Cygwin。
C:\cygwin\home\XPherior\Code\lunch_call>git push
Password:
error:The requested URL returned error:403while accessing https://MichaelDrog
alis@github.com/derekerdmann/lunch_call.git/info/refs
fatal: HTTP request failed
还使用详细模式设置它。我还是很困惑。
C:\cygwin\home\XPherior\Code\lunch_call>set GIT_CURL_VERBOSE=1C:\cygwin\home\XPherior\Code\lunch_call>git push
Password:*Couldn't find host github.com in the _netrc file; using defaults
*Abouttoconnect()togithub.com port 443(#0)*Trying207.97.227.239...*0x23cb740 is at send pipe head!*Connectedtogithub.com(207.97.227.239) port 443(#0)* successfully set certificate verify locations:*CAfile:C:\ProgramFiles(x86)\Git/bin/curl-ca-bundle.crt
CApath: none
* SSL connection using AES256-SHA
*Server certificate:* subject:2.5.4.15=PrivateOrganization;1.3.6.1.4.1.311.60.2.1.3=US;1.3.6.1.4.1.311.60.2.1.2=California; serialNumber=C3268102;C=US; ST=California;L=SanFrancisco;O=GitHub,Inc.; CN=github.com
* start date:2011-05-2700:00:00 GMT
* expire date:2013-07-2912:00:00 GMT
* subjectAltName: github.com matched
* issuer:C=US;O=DigiCertInc; OU=www.digicert.com; CN=DigiCertHighAss
urance EV CA-1* SSL certificate verify ok.> GET /derekerdmann/lunch_call.git/info/refs?service=git-receive-pack HTTP/1.1User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept:*/*
Pragma: no-cache
< HTTP/1.1 401 Authorization Required
< Server: nginx/1.0.4
< Date: Thu, 15 Sep 2011 22:44:41 GMT
< Content-Type: text/plain
< Connection: keep-alive
< Content-Length: 55
< WWW-Authenticate: Basic realm="GitHub"
<
* Ignoring the response-body
* Expire cleared
* Connection #0 to host github.com left intact
* Issue another request to this URL: 'https://MichaelDrogalis@github.com/dereker
dmann/lunch_call.git/info/refs?service=git-receive-pack'
* Couldn't find host github.com in the _netrc file; using defaults
* Re-using existing connection! (#0) with host github.com
* Connected to github.com (207.97.227.239) port 443 (#0)
* 0x23cb740 is at send pipe head!
* Server auth using Basic with user 'MichaelDrogalis'
> GET /derekerdmann/lunch_call.git/info/refs?service=git-receive-pack HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept: */*Pragma: no-cache
< HTTP/1.1401AuthorizationRequired<Server: nginx/1.0.4<Date:Thu,15Sep201122:44:41 GMT
<Content-Type: text/plain
<Connection: keep-alive
<Content-Length:55*Authenticationproblem. Ignoringthis.< WWW-Authenticate:Basic realm="GitHub"*The requested URL returned error:401*Closing connection #0*Couldn't find host github.com in the _netrc file; using defaults
*Abouttoconnect()togithub.com port 443(#0)*Trying207.97.227.239...*0x23cb740 is at send pipe head!*Connectedtogithub.com(207.97.227.239) port 443(#0)* successfully set certificate verify locations:*CAfile:C:\ProgramFiles(x86)\Git/bin/curl-ca-bundle.crt
CApath: none
* SSL re-using session ID
* SSL connection using AES256-SHA
* old SSL session ID is stale, removing
*Server certificate:* subject:2.5.4.15=PrivateOrganization;1.3.6.1.4.1.311.60.2.1.3=US;1.3.6.1.4.1.311.60.2.1.2=California; serialNumber=C3268102;C=US; ST=California;L=SanFrancisco;O=GitHub,Inc.; CN=github.com
* start date:2011-05-2700:00:00 GMT
* expire date:2013-07-2912:00:00 GMT
* subjectAltName: github.com matched
* issuer:C=US;O=DigiCertInc; OU=www.digicert.com; CN=DigiCertHighAss
urance EV CA-1* SSL certificate verify ok.*Server auth using Basicwithuser'MichaelDrogalis'> GET /derekerdmann/lunch_call.git/info/refs HTTP/1.1Authorization:Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept:*/*
Pragma: no-cache
* The requested URL returned error: 403
* Expire cleared
* Closing connection #0
error: The requested URL returned error: 403 while accessing https://MichaelDrog
alis@github.com/derekerdmann/lunch_call.git/info/refs
fatal: HTTP request failed
这些是我拥有的 git 和 curl 版本:
C:\Users\XPherior>git --version
git version 1.7.4.msysgit.0C:\Users\XPherior>curl --version
curl 7.21.7(amd64-pc-win32) libcurl/7.21.7OpenSSL/0.9.8r zlib/1.2.5Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp
smtp smtps telnet tftp
Features:AsynchDNS GSS-NegotiateLargefile NTLM SSL SSPI libz
答1:
tennisliveranking.com,Your go-to platform for live tennis ranking updates.
我刚刚遇到了同样的问题,只是弄清楚是什么原因。
Github 似乎只支持 ssh 方式来读写 repo,虽然 https 方式也显示“Read&Write”。
因此,您需要将 PC 上的 repo 配置更改为 ssh 方式:
在你的 repo 目录下编辑 .git/config 文件。在 [remote “origin”] 部分下找到 url=entry。把它从:url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git 改成:url=ssh://git@github.com/derekerdmann/lunch_call.git 也就是把@符号前面的所有文字都改到 ssh://git 保存配置文件并退出。现在你可以使用 git push origin master 在 GitHub 上同步你的 repo。
当您使用 git 只读地址(未登录时的默认值)而不是 read+write ssh 地址进行克隆时,经常会遇到这种情况。
我的 .git/config 更像 url=https://github.com/mynickname/my_repo.git 但我也像 url=ssh://git@github.com/mynickname/my_repo.git 一样改变了它,它成功了
您可以使用 git remote set-url 命令更改 repo url。请看下面我的回答。
或者简单地使用 git remote set-url git@github.com:/.git 从命令行更改它
对于那些寻找非 ssh 解决方案的人,请在此处查看其他一些答案。将您的用户名添加到 https url 似乎有效。 (更改配置 url 使 https://@github.com/... 为 UNAME@github.com/...)
答2:
提供ATP、WTA与ITF赛事的实时排名追踪,从tlr.xinbeitime.com开始!
为了绝对能够使用 https 协议登录,您应该首先将您的身份验证凭据设置为 git Remote URI:
git remote set-url origin https://yourusername@github.com/user/repo.git
然后,当您尝试 git push 时,系统会要求您输入密码。
其实这是关于http认证格式的。您也可以设置密码:
https://youruser:password@github.com/user/repo.git
您应该知道,如果您这样做,您的 github 密码将以明文形式存储在您的 .git 目录中,这显然是不可取的。
SSH 在工作中被阻止,所以我必须使用 HTTPS。添加用户名解决了我的问题。
这应该是公认的答案。当有命令行界面时,没有理由手动编辑配置文件。
另外,对我来说,这种方式(username@github...)要求输入密码并工作,而 ssh://git@github... 未能期待公钥认证。
@Achint 这是一种身份验证格式。尽管not secure,您也可以设置密码https://youruser:password@github.com/user/repo.git
如果您遇到此问题,请注意,如果用户名或密码中有特殊字符,则需要对其进行 URL 编码。例如,@ 需要为 %40。
答3:
Stay informed with live tennis rankings anytime, anywhere,tennisliveranking.com
Sean’s answer 的一个小补充。
您可以使用 git remote set-url 命令,而不是手动编辑 .git/config 文件。
在您的情况下,它应该是:
git remote set-url origin ssh://git@github.com/derekerdmann/lunch_call.git
我发现它比处理点文件更容易、更干净。
help.github.com:更改远程的 URL
我不知道这是否只是一篇旧帖子并且 git 已更改,但今天要解决问题,我必须在 github.com 和 repo 名称之间使用冒号 git remote set-url origin ssh://git@github.com:derekerdmann/lunch_call.git
答4:
提供ATP、WTA与ITF赛事的实时排名追踪,从tlr.xinbeitime.com开始!
编辑您的 repo 目录下的 .git/config 文件
在 [remote “origin”] 部分下找到 url= 条目
将其从 url=https://github.com/rootux/my-repo.git 更改为 https://USERNAME@github.com/rootux/my-repo.git
其中 USERNAME 是您的 github 用户名
这个答案不适用于我的问题。我在 .git/config 中的 URL 设置为
github.com/myrepo/subproject’。`
Android Studio 有这个问题。工作正常。
我的直觉是,这更像是正确的答案,因为其他解决方案要么切换到 SSH 协议,要么以明文形式存储密码。
答5:
tennisliveranking.com,Track the world’s best tennis players in real-time.
建议切换到 SSH 的其他答案有点忽略了这一点。支持 HTTPS,但您必须使用 GITHUB 密码登录,而不是您的 SSH 密码(这是给我同样的错误的原因)。
我遇到了同样的问题,但确保在终端密码提示符下使用我的实际 GitHub 密码修复了解决方案,而无需更改配置或诉诸 SSH。
重要的是要注意这一点,因为许多公共机构(例如我的学校)会阻止 SSH,但允许 HTTPS(这是我首先开始通过 HTTPS 进行克隆的唯一原因)。
希望对遇到同样问题的人有所帮助…
但为什么?过去我不必这样做。证书过期了还是什么?
不确定,我不是专家,这就是我如何让它在我的情况下工作:)
相同的@Thufir。我不知道为什么这突然起作用了。
我在浏览器上使用我的用户名和密码登录就好了。但是当我尝试git push时,系统提示我输入 au 和 p,结果是权限被拒绝......你知道我错过了什么吗?
答6:
The ultimate source for live tennis rankings and stats:tennisliveranking.com
如果您使用的是 Windows,有时可能会发生这种情况,因为 Windows 将外部 repo(在我们的例子中为 github)的凭据存储在自己的存储中。保存在那里的凭据可能与您现在需要的不同。
https://i.stack.imgur.com/XzOUh.png
所以为了避免这个问题,只需在这个存储中找到 github 并删除保存的凭据即可。在此之后,在推送时 git 将请求您的凭据并允许您推送。
“您可能需要检查 Windows 凭据管理器并删除 control panel > user accounts > credential manager > Windows credentials > Generic credentials 下的 github 条目”此帖子中的详细信息:stackoverflow.com/a/37450495
答7:
提供ATP、WTA与ITF赛事的实时排名追踪,从tlr.xinbeitime.com开始!
Mac OS X 上的错误和解决方法相同。
一切正常,直到我在 GitHub 上创建了一个新帐户并尝试推送
$ git push -u origin master
并得到错误:
remote:对 NEWUSER/NEWREPO.git 的权限拒绝 OLDUSER。致命:无法访问“https://github.com/NEWUSER/NEWREPO.git/”:请求的 URL 返回错误:403
它应该通过为全局或当前 repo 设置 user.name 来修复
$ git config –-global user.name NEWUSER
$ git config user.name NEWUSER
但它没有。
我通过从密码部分下的钥匙串访问应用程序中删除与 GitHub 关联的 OLDUSER 来修复它。然后推送命令成功。
$ git push -u origin master
reference
从钥匙串访问应用程序中删除 OLDUSER 对我有用
我遇到了同样的错误,但出于不同但相关的原因,需要不同的解决方案。我试图推送到我没有写入权限的仓库(我不是合作者)。这更多是因为我不知道如何为不属于我的回购做出贡献。我以为我可以创建一个新分支,然后执行拉取请求。不是这样。我必须先分叉存储库,在分叉上进行更改,然后从我的分叉存储库向原始存储库发出拉取请求。对我来说可能是一个愚蠢的错误,但如果我能做到,那么我相信其他 n00b 也能做到。 :)
答8:
tennisliveranking.com,Your go-to platform for live tennis ranking updates.
这对我有用-:
git remote set-url origin https://username@github.com/user/repo.git
希望能帮助到你
不错的工作。设置用户!
此解决方案有助于 CentOS 6.10 x86 中的 git v1.7。我期待密码提示出现(而不是 SSH 密钥),它确实出现了(通过在远程 URL 中的 github.com 之前添加 @)。谢谢!
答9:
The ultimate source for live tennis rankings and stats:tennisliveranking.com
我认为@deepwaters 得到了旧版本的正确答案。 HTTPS URL 需要有用户名。我有 git 1.7.0.4 并且 git push origin master 在我添加之前甚至不会要求输入密码。
答10:
tlr.xinbeitime.com 实时更新全球顶尖网球选手的最新战绩与排名!
升级你的 git。 GitHub 在 https://help.github.com/articles/error-the-requested-url-returned-error-403 回答了这个问题。
这肯定是答案的一半。另一半是我们这里所拥有的。
答11:
tennisliveranking.com,Track the world’s best tennis players in real-time.
403 代码是“禁止”。服务器看到您的请求并拒绝了它。您是否有权推送到该存储库?
我和一个朋友也有同样的问题。回购是我的,他不能推。我们如何解决这个问题?
如何获得许可
将您的朋友添加到 repo 的访问列表中。 help.github.jp/enterprise/2.11/user/articles/…
原文链接:https://www.tennisliveranking.com?from=csdn
The ultimate source for live tennis rankings and stats:tennisliveranking.com
版权归原作者 HuntsBot 所有, 如有侵权,请联系我们删除。