Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows WSL2环境中的git push在写入对象步骤中挂起 症状_Windows_Git_Windows Subsystem For Linux - Fatal编程技术网

Windows WSL2环境中的git push在写入对象步骤中挂起 症状

Windows WSL2环境中的git push在写入对象步骤中挂起 症状,windows,git,windows-subsystem-for-linux,Windows,Git,Windows Subsystem For Linux,我在WSL2环境中有一个git工作区。工作区位于/mnt/c/workspace/repo下,从Windows中也可以通过路径c:\workspace\repo看到该工作区 当我在工作区的WSL2端执行git推送时,git会挂断此消息 Enumerating objects: 39, done. Counting objects: 100% (39/39), done. Delta compression using up to 16 threads Compressing objects: 1

我在WSL2环境中有一个git工作区。工作区位于/mnt/c/workspace/repo下,从Windows中也可以通过路径c:\workspace\repo看到该工作区

当我在工作区的WSL2端执行git推送时,git会挂断此消息

Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects:  34% (9/26)
这是在此上下文中观察到的其他行为和环境信息

  • 我可以用git for Windows从Windows端推送这些文件,没有任何问题
  • 我可以在克隆文件后推几次。在我的一些推送操作之后,它就不起作用了
  • 此存储库仅包含文本文件。整个存储库大小小于1MB
  • 我已经使用这个环境好几个月了,但我只在这个存储库中观察到了这个问题
  • 当我将整个文件夹复制到~/workspace/repo时,这个问题也发生了,因为它不直接暴露于Windows
  • 远程设备配置为与SSH连接并使用/home/.SSH下的密钥
环境信息
  • WSL中的Linux映像:20.04.2 LTS(Focal Fossa)
  • Git版本:2.25.1
  • Windows版本:Microsoft Windows[版本10.0.19042.844]
我在stackoverflow的不同问题中遵循了这个答案。

这个变通办法对我不起作用

$ git push --set-upstream origin master -vvvv
Pushing to https://github.com/kyasbal-1994/<repo-name>.git
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 5.53 MiB | 7.42 MiB/s, done.
Total 26 (delta 6), reused 0 (delta 0)
POST git-receive-pack (5802813 bytes)
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
Windows权限更改属性-r+s 我已经按照此解决方法修复了Windows端的一些权限问题。

这个变通办法对我不起作用

$ git push --set-upstream origin master -vvvv
Pushing to https://github.com/kyasbal-1994/<repo-name>.git
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 5.53 MiB | 7.42 MiB/s, done.
Total 26 (delta 6), reused 0 (delta 0)
POST git-receive-pack (5802813 bytes)
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
试过sudogit推 我已经尝试过SudoGitPush-for,以防git命令无法访问一些锁文件

sudo GIT_SSH_COMMAND='ssh -i /home/<username>/.ssh/id_rsa' git push origin master
sudo GIT\u SSH\u COMMAND='SSH-i/home/.SSH/id\u rsa'GIT推送源主机
这个变通办法对我不起作用

$ git push --set-upstream origin master -vvvv
Pushing to https://github.com/kyasbal-1994/<repo-name>.git
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 5.53 MiB | 7.42 MiB/s, done.
Total 26 (delta 6), reused 0 (delta 0)
POST git-receive-pack (5802813 bytes)
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
使用https推送 错误消息已更改。但这种变通方法对我不起作用

$ git push --set-upstream origin master -vvvv
Pushing to https://github.com/kyasbal-1994/<repo-name>.git
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 16 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 5.53 MiB | 7.42 MiB/s, done.
Total 26 (delta 6), reused 0 (delta 0)
POST git-receive-pack (5802813 bytes)
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
$git push--设置上游原始主机-vvvv
推动https://github.com/kyasbal-1994/.git
枚举对象:39,完成。
计数对象:100%(39/39),完成。
增量压缩最多使用16个线程
压缩对象:100%(24/24),完成。
写入对象:100%(26/26),5.53 MiB | 7.42 MiB/s,完成。
总计26(增量6),重复使用0(增量0)
POST git接收包(5802813字节)
错误:RPC失败;curl 92 HTTP/2流0未完全关闭:取消(错误8)
致命:远程端意外挂起
致命:远程端意外挂起
一切都是最新的

您是否尝试过使用Windows
git.exe的路径从WSL调用Windows'
git
?实际上,您可以在
.bashrc
中设置别名:

alias wgit='/mnt/c/path\ to\ git/Git/git.exe`
这样,您就有了一个处理Windows文件的Windows可执行文件,而不是一个处理Windows文件的Linux可执行文件,尽管我对装载的工作方式有点模糊

但是,我不确定在输入路径时,这对用户有多友好

假设这是可行的,甚至有可能在bash中编写一个智能包装器函数来检测repo所在的文件系统并调用正确的git可执行文件


作为替代方案,您可能更幸运地维护两个单独的repo(WSL和Windows),然后通过服务器的推/拉同步。

您是否尝试过使用Windows
git.exe
的路径从WSL调用Windows'
git
?实际上,您可以在
.bashrc
中设置别名:

alias wgit='/mnt/c/path\ to\ git/Git/git.exe`
这样,您就有了一个处理Windows文件的Windows可执行文件,而不是一个处理Windows文件的Linux可执行文件,尽管我对装载的工作方式有点模糊

但是,我不确定在输入路径时,这对用户有多友好

假设这是可行的,甚至有可能在bash中编写一个智能包装器函数来检测repo所在的文件系统并调用正确的git可执行文件


作为替代方案,您可能更幸运地维护2个单独的回购协议(WSL和Windows),然后通过服务器的推/拉同步。

您如何进行身份验证?您是否使用
/home//.ssh
中的密钥和/或使用某种代理设置?是的,密钥在下面。根据您使用HTTPS收到的消息,我怀疑存在某种网络问题,可能是非默认防病毒或防火墙,或代理或其他中间包。你在用这些东西吗?谢谢你的评论。我只启用了Windows Defender。我相信我没有用一些奇怪的网络配置来配置我的ubuntu环境。但是,稍后我将尝试禁用Windows Defender。您如何进行身份验证?您是否使用
/home//.ssh
中的密钥和/或使用某种代理设置?是的,密钥在下面。根据您使用HTTPS收到的消息,我怀疑存在某种网络问题,可能是非默认防病毒或防火墙,或代理或其他中间包。你在用这些东西吗?谢谢你的评论。我只启用了Windows Defender。我相信我没有用一些奇怪的网络配置来配置我的ubuntu环境。不过,稍后我将尝试禁用Windows Defender。感谢您建议我此缓解措施!这对我来说已经足够了。不过,让我等一段时间选择你作为最佳答案,因为可能有人提出了一些实际的原因。谢谢你给我这个建议!这对我来说已经足够了。然而,让我等待一段时间选择你作为最佳答案,因为可能有人提出了一些实际的原因。