代码之家  ›  专栏  ›  技术社区  ›  phil swenson

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

  •  17
  • phil swenson  · 技术社区  · 15 年前

    不知道发生了什么事,github对这个问题没有回应,所以我在这里问。一个月来第一次尝试git推送,结果得到了这个结果。打开export 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$ 
    
    4 回复  |  直到 11 年前
        1
  •  17
  •   Will    15 年前

    我也有同样的问题,我相信这与回购的大小(编辑的——或者特定文件的大小)有关。

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

    编辑

    我发现问题可能是 大文件。我有一个最新消息 即使我有,也不会有压力 提交中只有一个文件 但刚好是160万

    git配置http.postBuffer524288000

    允许最大文件大小为500M 然后我的推起了作用。可能是的 这就是最初的问题 通过http推送一个大型回购协议

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

    希望这有帮助。

        2
  •  8
  •   Dilip Rajkumar    13 年前

    我也有同样的问题。这就是我解决问题的方法。

    1. 我增加了缓冲区的大小

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

    希望这对某人有帮助。。

        3
  •  4
  •   Community CDub    8 年前

    smart http(s) protocol “,哪个 GitHub now supports .
    假设这里没有代理问题,或者防火墙问题。


    (什么 git remote -v show 列表?)

    我建议:

        machine github.com
        login your_github_login
        password your_github_password
    
    • git clone https://github.com/your_github_login/gitrepo.git ,并推过该实例。

    注:作为 Noufal Ibrahim

    git clone ssh://user@server:project.git
    
        4
  •  1
  •   Ian    14 年前

    对于那些在创建新的.netrc文件时遇到困难的用户,请验证它是否在您的主目录(cd~/)中,确保您可以阅读它(chmod 600~/.netrc),并确保它如下所示:

    机器github.com网站