gitreceive-pack使用双引号,但不使用单引号,而git使用单引号调用它



我正在windows服务器上设置git存储库(2019(,并试图遵循https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server.然而,无论我做什么,git push都会带来致命的问题:"/Users/testing/testrepo.git"似乎不是git存储库。

我运行了:
git-init
git-add-test.txt(测试文件,只包含测试(
git-commit-m"测试">
git remote add origin testing@(removed(:Users/testing/testrepo.git
git push origin master

经过一段时间的挣扎,我为ssh启用了日志记录,并在服务器端日志文件中找到了这一行:
7744 2021-06-09 03:58:37.691-debug1:执行命令:"c: \windows\system32\cmd.exe"c";git接收包'/Users/testing/testrepo.git'";在没有pty的情况下,

我尝试手动运行git-receeve包'/Users/testing/testrepo.git',但它也出现了同样的错误。然而,我随后尝试运行gitreceivepack"Users/testing/testrepo.git";,它为
00bb00000000000000000000000000000000000000提供了^{}报告状态报告-status-v2删除refs side-band-64k安静原子ofs delta对象format=sha1-agent=git/23.0.windows.10000

唯一的区别是"而不是"。这是windows服务器的问题吗,还是我做错了什么?

发现这是我使用的ssh服务器的问题:https://github.com/PowerShell/Win32-OpenSSH/issues/752.评论中的一个解决方案是将git receivepack和uploadpack命令设置为使用powershell,但由于我不想为我的全局git配置更改它,也不想为每个存储库更改它,我找到了一个更好的解决方案。下列的https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration,我添加了一个注册表项到HKLM:\SOFTWARE\OpenSSH:DefaultShell="C: \windows\System32\WindowsPowerShell\v1.0\powershell.exe";。现在,ssh命令默认会在该服务器上转到powershell,这修复了gitreceive-pack的问题。

最新更新