Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
推送到GitHub错误:无法';在.netrc文件中找不到主机github.com;使用默认值_Git_Github_Git Push - Fatal编程技术网

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

推送到GitHub错误:无法';在.netrc文件中找不到主机github.com;使用默认值,git,github,git-push,Git,Github,Git Push,我不知道,到底发生了什么,我没有收到github的回复。我在一个月左右的时间里第一次尝试推git,结果得到了这个。启用了导出GIT\u CURL\u 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 gith

我不知道,到底发生了什么,我没有收到github的回复。我在一个月左右的时间里第一次尝试推git,结果得到了这个。启用了导出GIT\u CURL\u 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$ 
localhost:send2mobile\u$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已匹配
*发行人:C=美国;ST=亚利桑那州;L=斯科茨代尔;O=GoDaddy.com,Inc。;OU=http://certificates.godaddy.com/repository; CN=安全的证书颁发机构;序列号=07969287
*SSL证书验证正常。
>GET/303devworks/send2mobile_rails.git/info/refs?service=git接收包HTTP/1.1
用户代理:git/1.7.1
主持人:github.com
接受:*/*
Pragma:没有缓存
GET/303devworks/send2mobile_rails.git/info/refs?service=git接收包HTTP/1.1
授权:基本MZAZZGVFD29SA3M6Y29NBMWZNW
用户代理:git/1.7.1
主持人:github.com
接受:*/*
Pragma:没有缓存
POST/303devworks/send2mobile_rails.git/git-receive-pack HTTP/1.1
授权:基本JzAzZGV1d29ya3M6Y25nb29zNzIq
用户代理:git/1.7.1
主持人:github.com
接受编码:deflate,gzip
内容类型:application/x-git-receive-pack-request
接受:应用程序/x-git-receive-pack-result
预期:100人继续
传输编码:分块
*请求的URL返回错误:411
*正在关闭连接#0
错误:RPC失败;结果=22,HTTP代码=411
写入对象:100%(140/140),2.28 MiB | 1.93 MiB/s,完成。
总计140(增量24),重复使用0(增量0)
^C
本地主机:send2mobile\u rails phil$

看起来您正试图使用“”进行推送,而这正是。
假设这里没有代理问题或防火墙问题

您的远程上游回购地址是什么?
(什么
git remote-v show
列表?)

我建议:

  • 确保使用如下地址:
  • 有一个
    ~/.netrc
    文件

我也有同样的问题,我认为这与你试图推动的回购协议的大小(编辑过的——或特定文件的大小)有关

基本上,我能够创建新的回购协议并将其推送到github。但一个现有的方案是行不通的

HTTP错误代码似乎支持我,这是一个“长度要求”错误。所以,也许它太大了,无法计算,或者变大了,最大值谁知道呢

编辑

我发现问题可能是 大文件。我有一个更新 即使我有 成功推动了这一点。 提交中只有一个文件 但碰巧是160万

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

git config http.postBuffer 524288000

允许最大为500米的文件大小,以及 然后我的推起作用了。可能是 这是最初的问题 通过http推动大型回购协议 协议

结束编辑

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


希望这能有所帮助。

对于那些在创建新的.netrc文件时遇到困难的人,请验证它是否位于主目录(cd~/)中,确保它是可读的(chmod 600~/.netrc),并确保它看起来像这样:

machine github.com
登录GithubLogin

密码yourgithub密码

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

  • 我增加了缓冲区的大小

    git-config-http。 machine github.com login your_github_login password your_github_password
    git clone ssh://user@server:project.git