有很多关于做“git push'在大型存储库中,您会收到如下错误:
the remote end hung up unexpectedly.
发生这种情况有几个原因,但在我的情况下,我通过让ssh发送一个空包来保持ssh连接存活来阻止它发生。我把它添加到〜/ .ssh / config:
Host *
ServerAliveInterval 30
ServerAliveCountMax 4
这样就可以阻止那个远程端挂起来了#39;错误,但我看到发生的事情是git只是永远坐在那里。
如果我对正在运行的git进程执行pstack:
#13 lock_ref_for_update (err=0x7ffde40f2530, affected_refnames=0x7ffde40f23b0, head_ref=0xc979c0 "refs/heads/master", transaction=0xdd1ef0, update=0x1096e10, refs=0xc98c90) at refs/files-backend.c:2792
#14 files_transaction_commit (ref_store=<optimized out>, transaction=0xdd1ef0, err=0x7ffde40f2530) at refs/files-backend.c:2989
#15 0x00000000004606c9 in execute_commands_non_atomic (si=0x7ffde40f2560, commands=0xc98f80) at builtin/receive-pack.c:1357
#16 execute_commands (push_options=0x7ffde40f24e0, si=0x7ffde40f2560, unpacker_error=0x0, commands=0xc98f80) at builtin/receive-pack.c:1478
#17 cmd_receive_pack (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin/receive-pack.c:1941
#18 0x000000000040600d in run_builtin (argv=0x7ffde40f2e60, argc=2, p=0x7e3e78 <commands+1944>) at git.c:371
#19 handle_builtin (argc=2, argv=0x7ffde40f2e60) at git.c:572
#20 0x0000000000406277 in run_argv (argv=0x7ffde40f2c20, argcp=0x7ffde40f2c2c) at git.c:624
#21 cmd_main (argc=2, argc@entry=3, argv=0x7ffde40f2e60, argv@entry=0x7ffde40f2e58) at git.c:701
#22 0x00000000004054bf in main (argc=3, argv=0x7ffde40f2e58) at common-main.c:43
pstack中的重要一行是第一个&#39;#13&#39;,它似乎试图锁定&#39; refs / heads / master&#39;,但如果我检查我的git存储库:
[atlbitbucket@dubengvm494 fw]$ cd refs/heads
[atlbitbucket@dubengvm494 heads]$ ll
total 0
这是git中的错误吗? (版本2.13)我原以为它会说像无效的git存储库,没有refs founds&#39;。相反,它仍然锁定在这个循环中:
while (1) {
int was_alias = run_argv(&argc, &argv);
if (errno != ENOENT)
break;
if (was_alias) {
fprintf(stderr, "Expansion of alias '%s' failed; "
"'%s' is not a git command\n",
cmd, argv[0]);
exit(1);
}
if (!done_help) {
cmd = argv[0] = help_unknown_cmd(cmd);
done_help = 1;
} else
break;
}