推送到 GitHub 错误:无法在 .netrc 文件中找到主机 github.com;使用默认值
我不知道发生了什么,我没有得到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://[email protected]/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 don't know, what is going on, I got no response from github. I 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://[email protected]/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$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,并认为这与您尝试推送的存储库的大小(编辑后的或特定文件的大小)有关。
基本上我能够创建新的存储库并将它们推送到 github。但现有的一个是行不通的。
HTTP 错误代码似乎支持我,它是“需要长度”错误。所以也许它太大而无法计算或大于最大值。谁知道呢。
编辑
END EDIT
我可以让它工作的方式(在修改 postBuffer 之前进行编辑)是打包我的存储库,将其复制到可以通过 ssh 执行 git 的机器,然后将其推送到 github。然后,当您尝试从原始服务器进行推/拉时,它应该通过 https 工作。 (因为它的数据量比原始推送少得多)。
希望这有帮助。
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
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.
我遇到了同样的问题。这就是我解决问题的方法。
我增加了缓冲区大小
git config http.postBuffer 524288000
然后我检查了服务器中的用户,我的用户名被删除了。因此,我使用以下命令重新创建了该文件 sudo htpasswd -c /etc/users dilip_rajkumar
希望这对某些人有帮助。
I got the same issue. This is how I solved my problem.
I increased the buffer size
git config http.postBuffer 524288000
Then I checked the users in the server and my user name was removed. So I recreated the file using following command
sudo htpasswd -c /etc/users dilip_rajkumar
Hope this helps some one..
看来您正在尝试使用“智能http(s)协议”,GitHub 现在支持。
假设您没有代理问题或防火墙问题。
您的远程上游存储库地址是什么?
(
git remote -v show
列出了什么?)我建议:
~/.netrc
文件,并git clone https://github.com/ your_github_login/gitrepo.git
,并推送该实例。注意:如 Noufal Ibrahim 评论,您可以使用 ssh (除非 ssh 端口被阻止,只剩下 http/ https 连接)
It looks like you are trying to push using "smart http(s) protocol", which GitHub now supports.
Let's suppose here you have no proxy issue, or firewall problem.
What is your remote upstream repo address?
(what
git remote -v show
lists?)I would recommend:
~/.netrc
file withgit clone https://github.com/your_github_login/gitrepo.git
, and push through that instance.Note: as Noufal Ibrahim comments, you could use ssh (unless ssh port is blocked, leaving you only with http/https connections)
,请验证它是否位于您的 HOME 目录 (cd ~/) 中,确保您可以读取它 (chmod 600 ~/.netrc),并确保它如下所示:
对于那些在创建新的 .netrc 文件时遇到困难的人 github.com
登录 yourgithublogin
密码 你的github密码
For those having trouble creating a new .netrc file, verify that it is in your HOME directory (cd ~/), make sure it is readable by you (chmod 600 ~/.netrc), and make sure it looks like this:
machine github.com
login yourgithublogin
password yourgithubpassword