Git推送时卡住了,显示Total后无响应

3
我最近在Vultr上设置了一个VPS,并设置了远程git仓库来上传我的项目。当我把远程添加到我的本地项目并尝试第一次推送时,它会在显示“Total 119 (delta 9), reused 0 (delta 0)”后挂起。
为了提供一些背景信息:
- 服务器是Ubuntu 17.04 x64的全新设置 - 我本地使用的是git版本2.14.1 - 我之前已经在另一个VPS上(Ubuntu 16.04 x64)完成了此操作,并且一切正常 - 本地git项目已正确设置,因为我在BitBucket上有一个远程仓库,在那里我可以成功地推送项目 - 我已经尝试增加缓冲区大小,如其他类似问题所建议的那样 - 我正在尝试上传一个新的、小的Laravel项目——没有特殊或大文件(每个文件都在1MB以下) - 我已将git版本更新到最新可用版本(从2.12升级到2.14),如其他类似问题所建议的那样 - 我的SSH连接工作正常,并且我甚至设置了Debug Level 3,因此非常详细(下面是日志) - 远程仓库似乎已正确设置(我尝试创建了一个附加的远程仓库,指向同一台服务器上不存在的仓库,使用相同的SSH连接,我从GIT收到了一个正确的错误消息,说明它找不到仓库) - 我已经使用--shared和没有--shared设置过仓库,但结果是一样的 - 我甚至等待了(超过8个小时),什么都没发生,没有错误消息,它仍然挂起 - 我尝试了我能在这个问题上找到的每一个解决方案,但我仍然得到同样的结果(甚至重新创建了我的仓库几次,尝试了不同的名称,为我的仓库和服务器上的工作目录尝试了chmod 777等)
下面是git push时ssh详细输出的一部分(在验证ssh密钥之后):
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to 45.63.116.43 ([45.63.116.43]:22).
debug2: fd 4 setting O_NONBLOCK
debug2: fd 5 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending command: git-receive-pack '/var/repo/hc-teaser.git'
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Counting objects: 119, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (104/104), done.
Writing objects: 100% (119/119), 277.89 KiB | 5.91 MiB/s, done.
Total 119 (delta 9), reused 0 (delta 0)
debug2: channel 0: read<=0 rfd 4 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug3: send packet: type 96
debug2: channel 0: input drain -> closed
debug2: channel 0: rcvd adjust 65689

在最后一行之后,它就无限期地挂起了。


看一下这个问题:https://dev59.com/AWUo5IYBdhLWcg3wrhLj - jmarks
1个回答

1
问题是目标文件夹权限不足。当我创建目标文件夹时,使用了 "sudo",所以所有者被设置为 root。当我将目标文件夹的所有者更改为我的用户(用于推送 repo 的用户)和组为 www-data 时,一切都像魔法般地运行。
因此,我学到了当 git 无法将文件从 repo 移动到目标文件夹时,因为它没有适当的授权,它不会显示任何错误报告,它只会无限期地等待。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接