[英]git push in WSL2 environment hang up during Writing Objects step
I have a git workspace in WSL2 environment.我在 WSL2 环境中有一个 git 工作区。 The workspace is located under /mnt/c/workspace/repo where is also visible from Windows by the path C:\workspace\repo .工作区位于/mnt/c/workspace/repo下,从 Windows 通过路径C:\workspace\repo也可以看到。
When I do git push from WSL2 side in the workspace, Git hang up with this message.当我在工作区中从 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)
This is the other observed behavior and environment information in this context.这是在此上下文中观察到的其他行为和环境信息。
$ git config --global --list
user.email=<my mail address>
user.name=<my name>
http.postbuffer=524288000
git config --global http.postBuffer 524288000
I've followed this answer in different question in stackoverflow.我在stackoverflow的不同问题中遵循了这个答案。 https://stackoverflow.com/a/26663047/3200358 https://stackoverflow.com/a/26663047/3200358
This workaround won't work for me.这种解决方法对我不起作用。
I've followed this workaround to fix some permission problem in Windows side.我已经按照这个解决方法来修复 Windows 端的一些权限问题。 https://stackoverflow.com/a/63483040/3200358 https://stackoverflow.com/a/63483040/3200358
attrib -r +s C:\workspace\repo
This workaround won't work for me.这种解决方法对我不起作用。
I've tried sudo git push for in case when git command can't access some lock files.我试过 sudo git push 以防 git 命令无法访问某些锁定文件。
sudo GIT_SSH_COMMAND='ssh -i /home/<username>/.ssh/id_rsa' git push origin master
This workaround won't work for me.这种解决方法对我不起作用。
The error message was changed.错误消息已更改。 But this workaround won't work for me.但是这种解决方法对我不起作用。
$ 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
Have you tried invoking Windows' git
from WSL by using the path to the Windows git.exe
?您是否尝试过使用 Windows git.exe
git
In fact you could set up an alias in your .bashrc
:实际上,您可以在.bashrc
中设置别名:
alias wgit='/mnt/c/path\ to\ git/Git/git.exe`
This way, you have a Windows executable dealing with Windows files instead of a Linux executable dealing with Windows files, though I'm a little fuzzy on how things work with the mounting. This way, you have a Windows executable dealing with Windows files instead of a Linux executable dealing with Windows files, though I'm a little fuzzy on how things work with the mounting.
However, I'm not sure how user-friendly this may be when entering paths.但是,我不确定输入路径时这可能对用户有多友好。
Assuming that works, there's probably even a way to write a smart wrapper function in bash that detects which file system the repo is on and invokes the right git executable...假设可行,甚至可能有一种方法可以在 bash 中编写智能包装器 function 来检测存储库所在的文件系统并调用正确的 ZBA9F11ECC3497D9993B933FDC2BD6...
As an alternative, you may have more luck maintaining 2 separate repos (WSL & Windows) and then syncing via push/pulls from a server.作为替代方案,您可能会更幸运地维护 2 个独立的存储库(WSL 和 Windows),然后通过服务器的推/拉同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.