gitlab-shell -> git push -u origin master -> fatal: 远程端意外挂断
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15444483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gitlab-shell -> git push -u origin master -> fatal: The remote end hung up unexpectedly
提问by 1000i100
I'm using gitlab-shell to manage git connections and here is my problem :
我正在使用 gitlab-shell 来管理 git 连接,这是我的问题:
$ git push -v -u origin master
Pushing to [email protected]:monProjet.git
fatal: The remote end hung up unexpectedly
# tail -f /var/log/auth.log
Mar 15 15:53:12 my-srv sshd[3133]: Accepted publickey for git from my-ip port 50790 ssh2
Mar 15 15:53:12 my-srv sshd[3133]: pam_unix(sshd:session): session opened for user git by (uid=0)
Mar 15 15:53:12 my-srv sshd[3285]: Received disconnect from my-ip: 11: disconnected by user
Mar 15 15:53:12 my-srv sshd[3133]: pam_unix(sshd:session): session closed for user git
So everybody say it's the other fault?! How can I have more informations about the git/ssh network exchange?
所以大家都说是别人的错?!如何获得有关 git/ssh 网络交换的更多信息?
回答by 1000i100
I've tried this : $ ssh -vT [email protected]
我试过这个: $ ssh -vT [email protected]
I've see in the log an http redirect 301. (my proxy server redirect http to https)
我在日志中看到一个 http 重定向 301。(我的代理服务器将 http 重定向到 https)
I've correct it in gitlab-shell config, file : /home/git/gitlab-shell/config.yml
我已经在 gitlab-shell 配置文件中更正了它:/home/git/gitlab-shell/config.yml
# Url to gitlab instance. Used for api calls
gitlab_url: "https://git.my-srv.fr/"
the new error message was a ssl certificate verification fail (my certificate is auto-signed with no 3rd part autority)
新的错误消息是 ssl 证书验证失败(我的证书是自动签名的,没有第三部分的权限)
so i've modified /home/git/gitlab-shell/lib/gitlab_net.rbto add this :
所以我修改了 /home/git/gitlab-shell/lib/gitlab_net.rb来添加这个:
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if (http.use_ssl?)
between these lines :
在这些行之间:
http.use_ssl = (url.port == 443)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if (http.use_ssl?)
request = Net::HTTP::Get.new(url.request_uri)
Like describe on this gitlab-shell closed pull request (and issue) : https://github.com/gitlabhq/gitlab-shell/pull/9
就像在这个 gitlab-shell 关闭拉取请求(和问题)上描述的一样:https: //github.com/gitlabhq/gitlab-shell/pull/9
And here is the original commit content : https://github.com/jcockhren/gitlab-shell/commit/846ee24697f386cd9fcbc4ab1a7fb8ae1ccb46ee
这是原始提交内容:https: //github.com/jcockhren/gitlab-shell/commit/846ee24697f386cd9fcbc4ab1a7fb8ae1ccb46ee
回答by Ororuk
Since the version 5.4, you can to edit on gitlab-shell/config.yml
从 5.4 版本开始,您可以在gitlab-shell/config.yml上进行编辑
self_signed_cert: true
self_signed_cert: 真
回答by Robert de W
Modifying the config.yml for gitlab-shell to point to the right URL fixed it for me (although I'm pushing using git@..)
修改 gitlab-shell 的 config.yml 以指向正确的 URL 为我修复了它(尽管我正在使用 git@..)
https://github.com/gitlabhq/gitlab-shell/issues/65
https://github.com/gitlabhq/gitlab-shell/issues/65
The config.yml of gitlab-shell should correctly point the URL. In my case it was http://git.domain.com:8080/.
gitlab-shell 的 config.yml 应该正确指向 URL。就我而言,它是http://git.domain.com:8080/。
回答by MrJ
I had the exact same behavior on my gitlab installation. In my case it was a problem with the ssl certificates. It was hard to catch because:
我的 gitlab 安装有完全相同的行为。就我而言,这是 ssl 证书的问题。很难抓住,因为:
https://gitlab.example.com ==> padlock shows up, everything seems OK
openssl s_client -connect ==> Verify return code: 21 (unable to verify...
Since gitlab uses openssl to verify the ssl connection, it exits fatal when openssl complains. The problem was fixed by creating a "correct" cert for my server gitlab.example.com by pasting:
由于 gitlab 使用 openssl 来验证 ssl 连接,所以当 openssl 抱怨时它退出致命。通过粘贴以下内容为我的服务器 gitlab.example.com 创建“正确”证书解决了该问题:
ROOT-issuers-cert
Intermediate-cert
cert-for-example.com
into one text file.
成一个文本文件。
回答by Arie
In case anyone comes to this thread like me searching on the error ..
万一有人像我一样在这个帖子中搜索错误..
It's clear the error arrives when git can't access the gitlab webserver. For me it was a http user authentication I had put on nginx. After removing it, the error was gone.
很明显,当 git 无法访问 gitlab 网络服务器时会出现错误。对我来说,这是我在 nginx 上进行的 http 用户身份验证。删除后,错误消失了。