Подтвердить что ты не робот

Git push over HTTP (не HTTPS) на Ubuntu зависает после отправки файлов

Я видел много примеров подобных проблем, но они, как правило, относятся к HTTPS (как показано ниже, я использую прямой HTTP) или размер буфера (я попытался установить размер буфера с помощью git config http.postBuffer 524288000 "даже если файл, который я нажимаю, пуст) или с помощью Windows на стороне клиента (я на Ubuntu).

Я установил сервер git, используя git -http-backend, создал пустой сервер на сервере и успешно клонировал его локально. Я добавил один пустой файл и пытаюсь нажать его, и он загружается, затем зависает после общей строки.

$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git push
07:07:45.884509 git.c:344               trace: built-in: git 'push'
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

07:07:45.886216 run-command.c:334       trace: run_command: 'git-remote-http' 'origin' 'http://user:[email protected]/git/tmp.git'
* Couldn't find host server.com in the .netrc file; using defaults
*   Trying 74.220.207.144...
* Connected to server.com (74.220.207.144) port 80 (#0)
> GET /git/tmp.git/info/refs?service=git-receive-pack HTTP/1.1
Host: server.com
User-Agent: git/2.7.4
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: nginx/1.10.1
< Date: Sat, 10 Sep 2016 14:07:46 GMT
< Content-Type: text/html
< Content-Length: 134
< Connection: keep-alive
< WWW-Authenticate: Basic realm="Git Repo"
< Accept-Ranges: bytes
< Vary: Accept-Encoding
< Content-Encoding: gzip
< 
* Ignoring the response-body
* Connection #0 to host server.com left intact
* Issue another request to this URL: 'http://user:[email protected]/git/tmp.git/info/refs?service=git-receive-pack'
* Couldn't find host server.com in the .netrc file; using defaults
* Found bundle for host server.com: 0xedc7c0 [can pipeline]
* Re-using existing connection! (#0) with host server.com
* Connected to server.com (74.220.207.144) port 80 (#0)
* Server auth using Basic with user 'user'
> GET /git/tmp.git/info/refs?service=git-receive-pack HTTP/1.1
Host: server.com
Authorization: Basic anASDCNakvca0941cas65w==
User-Agent: git/2.7.4
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: nginx/1.10.1
< Date: Sat, 10 Sep 2016 14:07:46 GMT
< Content-Type: application/x-git-receive-pack-advertisement
< Content-Length: 127
< Connection: keep-alive
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Content-Encoding: gzip
< 
* Connection #0 to host server.com left intact
07:07:46.424994 run-command.c:334       trace: run_command: 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--progress' 'http://user:[email protected]/git/tmp.git/' '--stdin'
07:07:46.425961 exec_cmd.c:120          trace: exec: 'git' 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--progress' 'http://user:[email protected]/git/tmp.git/' '--stdin'
07:07:46.435357 git.c:344               trace: built-in: git 'send-pack' '--stateless-rpc' '--helper-status' '--thin' '--progress' 'http://user:[email protected]/git/tmp.git/' '--stdin'
07:07:46.436162 run-command.c:334       trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
07:07:46.436700 exec_cmd.c:120          trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
07:07:46.439015 git.c:344               trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
Counting objects: 3, done.
Writing objects: 100% (3/3), 200 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
* Couldn't find host server.com in the .netrc file; using defaults
* Found bundle for host server.com: 0xedc7c0 [can pipeline]
* Re-using existing connection! (#0) with host server.com
* Connected to server.com (74.220.207.144) port 80 (#0)
* Server auth using Basic with user 'user'
> POST /git/tmp.git/git-receive-pack HTTP/1.1
Host: server.com
Authorization: Basic anASDCNakvca0941cas65w==
User-Agent: git/2.7.4
Accept-Encoding: gzip
Content-Type: application/x-git-receive-pack-request
Accept: application/x-git-receive-pack-result
Content-Length: 336

* upload completely sent off: 336 out of 336 bytes
< HTTP/1.1 200 OK
< Server: nginx/1.10.1
< Date: Sat, 10 Sep 2016 14:07:46 GMT
< Content-Type: application/x-git-receive-pack-result
< Content-Length: 21
< Connection: keep-alive
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< Content-Encoding: gzip
< 
* Connection #0 to host server.com left intact

В журнале ошибок сервера apache я вижу эту строку в этой точке:

[Sat Sep 10 08:07:46 2016] [error] [client 204.15.222.20] fatal: The remote end hung up unexpectedly
4b9b3361

Ответ 1

Сначала, по крайней мере, установите git config --global push.default simple: это позволит избежать шума, который вы видите при нажатии.

Во-вторых, не забудьте использовать Git 2.10 как для клиента, так и для сервера.
Это позволит использовать больше параметров трассировки, например, последние GIT_TRACE_CURL.

В-третьих, для тестирования попробуйте деактивировать аутентификацию на стороне Apache, чтобы узнать, завершено ли нажатие (раньше была проблема, в git отказывается отправлять учетные данные HTTP? ")


Обратите внимание, что iwth Git 2.17 (Q2 2018), код трассировки http, часто используемый для отладки проблем подключения, научился удалять потенциально уязвимую информацию из своего вывода, чтобы можно было более безопасно скрещивать.

См. commit 8ba18e6, commit 8341178 ( 19 января 2018 года) Джонатан Тан (jhowtan).
(слияние Junio ​​C Hamano - gitster - в commit 5327463, 13 февраля 2018 года)

http: поддержка опускания данных из трасс

GIT_TRACE_CURL обеспечивает способ отладки того, что отправляется и принимается через HTTP, с автоматическим редактированием конфиденциальной информации.
Но он также регистрирует передачу данных, что значительно увеличивает файл журнала размер, иногда излишне.

Добавьте опцию "GIT_TRACE_CURL_NO_DATA", чтобы позволить пользователям опускать такие передачи данных.