gitlab-shell -> git push -u origin master -> fatal: The remote end hung up unexpectedly

15,200

Solution 1

I've tried this : $ ssh -vT [email protected]

I've see in the log an http redirect 301. (my proxy server redirect http to https)

I've correct it in gitlab-shell config, file : /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)

so i've modified /home/git/gitlab-shell/lib/gitlab_net.rb to add this :

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

And here is the original commit content : https://github.com/jcockhren/gitlab-shell/commit/846ee24697f386cd9fcbc4ab1a7fb8ae1ccb46ee

Solution 2

Since the version 5.4, you can to edit on gitlab-shell/config.yml

self_signed_cert: true

Solution 3

Modifying the config.yml for gitlab-shell to point to the right URL fixed it for me (although I'm pushing using git@..)

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/.

Solution 4

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:

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:

ROOT-issuers-cert
Intermediate-cert
cert-for-example.com

into one text file.

Share:
15,200
1000i100
Author by

1000i100

Dev Web freelance specialized on advanced css and javascript (including node.js), i also manage my own linux servers since 2003. I've used php daily for several years before my full-JS stack switch. I also use git and docker on all my project now and use TDD on most of them.

Updated on July 22, 2022

Comments

  • 1000i100
    1000i100 almost 2 years

    I'm using gitlab-shell to manage git connections and here is my problem :

    $ 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?