当前位置:  开发笔记 > 编程语言 > 正文

推送到GitHub错误:无法在.netrc文件中找到主机github.com; 使用默认值

如何解决《推送到GitHub错误:无法在.netrc文件中找到主机github.com;使用默认值》经验,为你挑选了2个好方法。

Dunno发生了什么事,没有github对此问题的回应所以我在这里问.在一个月左右的时间里第一次尝试了一个git push并得到了这个.打开导出GIT_CURL_VERBOSE = 1并进行推送并获取此信息:

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$ 

Will.. 17

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

基本上我能够创建新的repos并将它们推送到github.但现有的不行.

HTTP错误代码似乎支持我,它是一个"需要长度"错误.所以也许它太大而无法计算或最大化.谁知道.

编辑

我发现问题可能是文件很大.我有一个不会推动的更新,即使我已成功推进到那一点.提交中只有一个文件,但它恰好是1.6M

所以我添加了以下配置更改

git config http.postBuffer 524288000

允许最多500M的文件大小然后我的推送工作.这可能是最初在http协议上推出一个大型回购的问题.

结束编辑

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

希望这可以帮助.



1> Will..:

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

基本上我能够创建新的repos并将它们推送到github.但现有的不行.

HTTP错误代码似乎支持我,它是一个"需要长度"错误.所以也许它太大而无法计算或最大化.谁知道.

编辑

我发现问题可能是文件很大.我有一个不会推动的更新,即使我已成功推进到那一点.提交中只有一个文件,但它恰好是1.6M

所以我添加了以下配置更改

git config http.postBuffer 524288000

允许最多500M的文件大小然后我的推送工作.这可能是最初在http协议上推出一个大型回购的问题.

结束编辑

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

希望这可以帮助.


`git config http.postBuffer 524288000`命令对我有用!

2> Dilip Rajkum..:

我遇到了同样的问题.这就是我解决问题的方法.

    我增加了缓冲区大小

    git config http.postBuffer 524288000

    然后我检查了服务器中的用户,并删除了我的用户名.所以我使用以下命令重新创建了该文件sudo htpasswd -c /etc/users dilip_rajkumar

希望这有助于一些..

推荐阅读
mylvfamily
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有