推送到GitHub错误:在.netrc文件中找不到主机github.com;使用默认值 [英] Push to GitHub error: Couldn't find host github.com in the .netrc file; using defaults

查看:1270
本文介绍了推送到GitHub错误:在.netrc文件中找不到主机github.com;使用默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道发生了什么,Github没有回应这个概率,所以我在这里问。在一个月左右的时间里第一次尝试了git push,并得到了这个。打开导出GIT_CURL_VERBOSE = 1并进行推送并得到它:

  localhost:send2mobile_rails phil $ git push 
密码:
*在.netrc文件中找不到主机github.com;使用默认
*关于连接()到github.com端口443(#0)
*尝试207.97.227.239 ... *连接到github.com(207.97.227.239)端口443(#0 )
*使用DHE-RSA-AES256-SHA进行SSL连接
*服务器证书:
*主题:O = *。github.com; OU =域控制验证; CN = *。github.com
*开始日期:2009-12-11 05:02:36 GMT
*截止日期:2014-12-11 05:02:36 GMT
* subjectAltName:github.com匹配
* issuer:C = US; ST =亚利桑那; L =斯科茨; O = GoDaddy.com,Inc. OU = HTTP://certificates.godaddy.com/repository; CN = Go Daddy安全认证机构; serialNumber = 07969287
* SSL证书确认无误。
> GET /303devworks/send2mobile_rails.git/info/refs?service=git-receive-pack HTTP / 1.1
User-Agent:git / 1.7.1
Host:github.com
Accept: * / *
Pragma:no-cache

< b< HTTP / 1.1 401需要授权
<服务器:nginx / 0.7.61
<日期:2010年6月1日星期二10:53:13 GMT
<内容类型:text / html; charset = iso-8859-1
<连接:保持活动
< Content-Length:0
< WWW-Authenticate:Basic realm =Repository
<
*连接#0到主机github.com保留原样
*发出另一个请求到这个URL:'https://303devworks@github.com/MYUSERHERE/send2mobile_rails.git/info/refs?service = git-receive-pack'
*在.netrc文件中找不到主机github.com;使用默认值
*重新使用现有连接! (#0)与主机github.com
*连接到github.com(207.97.227.239)端口443(#0)
*使用Basic的用户'303devworks'的
服务器认证
> GET /303devworks/send2mobile_rails.git/info/refs?service=git-receive-pack HTTP / 1.1
授权:基本MzAzZGVfd29sa3M6Y29nbmwzNzIw
用户代理:git / 1.7.1
主机:github .com
接受:* / *
Pragma:no-cache

< b< HTTP / 1.1 200 OK
<服务器:nginx / 0.7.61
<日期:2010年6月1日星期二10:53:13 GMT
< Content-Type:application / x-git-receive-pack-advertisement
<连接:保持活动
<状态:200 OK
< Pragma:no-cache
<内容长度:153
<到期日:星期五,1980年1月1日00:00:00 GMT
< Cache-Control:no-cache,max-age = 0,必须重新验证
<
*过期清除
*连接#0到主机github.com保持完好
计数对象:166,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(133/133),完成。
*在.netrc文件中找不到主机github.com;使用默认
*关于连接()到github.com端口443(#0)
*尝试207.97.227.239 ... *连接
*连接到github.com(207.97.227.239 )端口443(#0)
* SSL重新使用会话标识
*使用DHE-RSA-AES256-SHA
*旧SSL会话标识的SSL连接已过时,删除
*服务器证书:
*主题:O = *。github.com; OU =域控制验证; CN = *。github.com
*开始日期:2009-12-11 05:02:36 GMT
*截止日期:2014-12-11 05:02:36 GMT
* subjectAltName:github.com匹配
* issuer:C = US; ST =亚利桑那; L =斯科茨; O = GoDaddy.com,Inc. OU = HTTP://certificates.godaddy.com/repository; CN = Go Daddy安全认证机构; serialNumber = 07969287
* SSL证书确认无误。
*使用Basic的用户'MYUSERHERE'的服务器认证
> POST /303devworks/send2mobile_rails.git/git-receive-pack HTTP / 1.1
授权:基本JzAzZGV1d29ya3M6Y25nb29zNzIq
用户代理:git / 1.7.1
主机:github.com
Accept-Encoding:deflate,gzip
Content-Type:application / x-git-receive-pack-request
Accept:application / x-git-receive-pack-result
Expect:100 -continue
Transfer-Encoding:chunked

*请求的URL返回错误:411
*关闭连接#0
错误:RPC失败;结果= 22,HTTP代码= 411
写入对象:100%(140/140),2.28 MiB | 1.93 MiB / s,完成。
总计140(增量24),重用0(增量0)
^ C
localhost:send2mobile_rails phil $


解决方案

我有同样的问题,并且认为它与repo的大小有关(编辑或特定文件的大小)你试图推。



基本上,我能够创建新的回购协议,并将它们推送到github上。但现有的一个将不起作用。



HTTP错误代码似乎支持我,它是一个'长度必需'错误。所以也许它太大以至于不能计算或者说最大值。谁知道。

编辑


我发现问题可能是
文件很大。我有一个更新
,即使我有
成功推动到那一点,它也不会推动。
在提交
中只有一个文件,但碰巧是1.6M



因此我添加了以下配置更改



git config http.postBuffer 524288000



允许最大文件大小为500M和
,然后我的推送工作。这可能是
,这就是最初
的问题,并推出了一个超过http
协议的大回购。


END EDIT



我可以使用它的方式(在我修改postBuffer之前编辑)的方法是将我的回购站点复制到一台机器上可以通过ssh执行git,并将其推送到github。然后,当您尝试从原始服务器执行推/拉时,它应该通过https工作。 (因为它比原来的推送数据量要小得多)。



希望这有助于您。


Dunno what's going on, no response from github on this prob so I'm asking here. Tried a git push for the first time in a month or so and got this. Turned on export GIT_CURL_VERBOSE=1 and did a push and get this:

localhost:send2mobile_rails phil$ git push
Password: 
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * Connected to github.com (207.97.227.239) port 443 (#0)
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*    subject: O=*.github.com; OU=Domain Control Validated; CN=*.github.com
*    start date: 2009-12-11 05:02:36 GMT
*    expire date: 2014-12-11 05:02:36 GMT
*    subjectAltName: github.com matched
*    issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certificates.godaddy.com/repository; CN=Go Daddy Secure Certification Authority; serialNumber=07969287
*    SSL certificate verify ok.
> GET /303devworks/send2mobile_rails.git/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.7.1
Host: github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: nginx/0.7.61
< Date: Tue, 01 Jun 2010 10:53:13 GMT
< Content-Type: text/html; charset=iso-8859-1
< Connection: keep-alive
< Content-Length: 0
< WWW-Authenticate: Basic realm="Repository"
< 
* Connection #0 to host github.com left intact
* Issue another request to this URL: 'https://303devworks@github.com/MYUSERHERE/send2mobile_rails.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)
* Server auth using Basic with user '303devworks'
> GET /303devworks/send2mobile_rails.git/info/refs?service=git-receive-pack HTTP/1.1
Authorization: Basic MzAzZGVfd29sa3M6Y29nbmwzNzIw
User-Agent: git/1.7.1
Host: github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: nginx/0.7.61
< Date: Tue, 01 Jun 2010 10:53:13 GMT
< Content-Type: application/x-git-receive-pack-advertisement
< Connection: keep-alive
< Status: 200 OK
< Pragma: no-cache
< Content-Length: 153
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Cache-Control: no-cache, max-age=0, must-revalidate
< 
* Expire cleared
* Connection #0 to host github.com left intact
Counting objects: 166, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (133/133), done.
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * connected
* Connected to github.com (207.97.227.239) port 443 (#0)
* SSL re-using session ID
* SSL connection using DHE-RSA-AES256-SHA
* old SSL session ID is stale, removing
* Server certificate:
*    subject: O=*.github.com; OU=Domain Control Validated; CN=*.github.com
*    start date: 2009-12-11 05:02:36 GMT
*    expire date: 2014-12-11 05:02:36 GMT
*    subjectAltName: github.com matched
*    issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certificates.godaddy.com/repository; CN=Go Daddy Secure Certification Authority; serialNumber=07969287
*    SSL certificate verify ok.
* Server auth using Basic with user 'MYUSERHERE'
> POST /303devworks/send2mobile_rails.git/git-receive-pack HTTP/1.1
Authorization: Basic JzAzZGV1d29ya3M6Y25nb29zNzIq
User-Agent: git/1.7.1
Host: github.com
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-receive-pack-request
Accept: application/x-git-receive-pack-result
Expect: 100-continue
Transfer-Encoding: chunked

* The requested URL returned error: 411
* Closing connection #0
error: RPC failed; result=22, HTTP code = 411
Writing objects: 100% (140/140), 2.28 MiB | 1.93 MiB/s, done.
Total 140 (delta 24), reused 0 (delta 0)
^C
localhost:send2mobile_rails phil$ 

解决方案

I had the same issue and believe that it has to do with the size of the repo (edited- or the size of a particular file) you are trying to push.

Basically I was able to create new repos and push them to github. But an existing one would not work.

The HTTP error code seems to back me up it is a 'Length Required' error. So maybe it is too large to calc or greated that the max. Who knows.

EDIT

I found that the problem may be files that are large. I had one update that would not push even though I had successful pushes up to that point. There was only one file in the commit but it happened to be 1.6M

So I added the following config change

git config http.postBuffer 524288000

To allow up to the file size 500M and then my push worked. It may have been that this was the problem initially with pushing a big repo over the http protocol.

END EDIT

the way I could get it to work (EDIT before I modified postBuffer) was to tar up my repo, copy it to a machine that can do git over ssh, and push it to github. Then when you try to do a push/pull from the original server it should work over https. (since it is a much smaller amount of data than an original push).

Hope this helps.

这篇关于推送到GitHub错误:在.netrc文件中找不到主机github.com;使用默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆