4

I have created a new branch in my local repository and after some commits, I wanted to push it to the remote repository.

git push origin new_branch

I have this error:

$ git push origin new_branch

Counting objects: 32, done.

Delta compression using up to 2 threads. Compressing objects: 100% (18/18),done.

Writing objects: 100% (18/18), 5.29 KiB, done. Total 18 (delta 13), reused 0 (delta 0)

Write failed: Broken pipe

fatal: The remote end hung up unexpectedly

fatal: The remote end hung up unexpectedly

When I user $ git remote -v

origin git@106.187.99.99:XXX.git (fetch)

origin git@106.187.99.99:XXX.git (push)

the git branch

fiberead_com$ git branch -a
* new_branch
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master
  remotes/origin/online

nginx.conf

user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
#    keepalive_timeout  65;
client_header_timeout 3m;
client_body_timeout 3m;
keepalive_timeout 175 120;
client_max_body_size 35m;

    tcp_nodelay        on;


    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

Can anybody help me, please?

My git server is in the Linode.I use GITLAB and the other project isn't have this problem.Only a new project ,I user 'git clone' to pull my computer.But when I push the code, something wrong have happen.

I use Nginx.

And I use '$ git push origin master', have the same problem.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
JeskTop
  • 471
  • 1
  • 4
  • 18
  • Broken pipe means the server cut your connection, usually indicates connectivity problems. Does it happen every time? After waiting some minutes does it still happen? – AD7six Aug 24 '12 at 07:46
  • What does the httpd logs says regarding that push? – VonC Aug 24 '12 at 07:48
  • How are your remotes set up? Please, show the output of `git remote -v` – davids Aug 24 '12 at 07:49
  • Check the server logs, check if the remote user has permissions to write to the repository… – Michael Krelin - hacker Aug 24 '12 at 07:52
  • The remote looks good, but your answer lies in the server log (httpd server, or gitlab logs) – VonC Aug 24 '12 at 08:01
  • Sorry @VonC , I don't know how to find the server log. – JeskTop Aug 24 '12 at 08:29
  • @JeskTop you need to search where your httpd server is installed, and look for a log directory. Check also your `httpd.conf` (which could be, for instance, at `/etc/httpd/httpd.conf`), each section can define its own log path. – VonC Aug 24 '12 at 08:45
  • @VonC Sorry .There is not httpd file in the etc file.I use Nginx – JeskTop Aug 24 '12 at 08:49
  • @JeskTop sure, so check the logs of nginx – VonC Aug 24 '12 at 08:54
  • @VonC Ok.I add the nginx.conf in the article. – JeskTop Aug 24 '12 at 09:02
  • Excellent: do you see anything suspect in the `/var/log/nginx/error.log` right after making a `git push`? – VonC Aug 24 '12 at 09:08
  • @VonC NO.The error.log is empty. – JeskTop Aug 24 '12 at 09:13
  • @JeskTop ok basically something is listening to your http request, redirecting them to gitlab. You need to find any .log file which would have changed recently and parse them for an error message, which will tell you what the root cause is. – VonC Aug 24 '12 at 09:18
  • @AD7six Yes.This problem is happened from yesterday. – JeskTop Aug 24 '12 at 13:20
  • @davids Sorry, the error.log is empty.Which log should I chenk? – JeskTop Aug 24 '12 at 13:23
  • @MichaelKrelin-hacker Sorry, the error.log is empty.Which log should I chenk? – JeskTop Aug 24 '12 at 13:23
  • @VonC Thank you very much.I solve this problem!You can "Answer this question",and I will choose you. – JeskTop Aug 24 '12 at 14:24
  • @JeskTop excellent: can you comment on what error message you did found and in which log? – VonC Aug 24 '12 at 14:32
  • @VonC I found all of log,but the error log are empty.The problem is the network.Because I am in China and there is a special network here.So the VPN can solve this problem. – JeskTop Aug 25 '12 at 03:51
  • @JeskTop ok, I have included your conclusion in the answer for more visibility. – VonC Aug 25 '12 at 08:14

3 Answers3

5

That means the http server in charge of listening to the request (here a git push over http) failed to complete.

  • Either because of a problem on the server:
    Only log of said http server contain the root cause (it can be for instance a message too big for the server to process, or a right issue, or ...).
    Those logs can be in etc/httpd/httpd.conf (Apache), or /var/log/nginx/error.log (NGiNX) or even in gitlab itself.

  • Or because it never received the request, which the OP jesktop confirms to be the case here:

I found all of log,but the error log are empty.
The problem is the network. Because I am in China and there is a special network here.
So the VPN can solve this problem.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
0

Try this:

git push origin feature/new_branch

and also check whether the connection is live or not.

ЯegDwight
  • 23,615
  • 10
  • 43
  • 51
  • $ git push origin origin/new_branch error: src refspec origin/frayay does not match any. error: failed to push some refs to 'git@106.187.99.99:XX.git' – JeskTop Aug 24 '12 at 08:33
  • $ git push origin origin/dev Total 0 (delta 0), reused 0 (delta 0) To git@106.187.99.99:XX.git * [new branch] origin/dev -> origin/dev – JeskTop Aug 24 '12 at 08:38
0

To people arriving from google: Six years later and this still periodically happens. I have seen this occur when I inadvertently committed an extremely large binary (et al). It was not sufficient to remove the binary and recommit to resolve the problem; Because of how Git works, the commit containing it originally remained, and so the size also did. The solution was to rebase the offending commit out completely.

Once I had identified a bad commit as the cause, the solution every time this occurs became clear: git bisect. This pops up for me maybe once or twice a year and not always because of a large file. Once you have ruled out network issues as the other answers here correctly point out, the solution for me is always the same - bisect, remove the offending commit, then you will be able to push.

MaxPRafferty
  • 4,276
  • 4
  • 25
  • 37