git-receive-pack 使用双引号而不是单引号,而 git 使用单引号调用它

git-receive-pack works with double quotes but not single quotes, while git calls it with single quotes

我正在 windows 服务器 (2019) 上设置 git 存储库,试图遵循 https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server。但是,无论我做什么,git push 都会出现 fatal: ''/Users/testing/testrepo.git'' does not appears to be a git repository.

我运行:
git 初始化
git添加test.txt(测试文件,刚刚包含测试)
git提交-m“测试”
git 远程添加源测试@(已删除):Users/testing/testrepo.git
git 推源主

为此苦苦挣扎了一段时间后,我启用了 ssh 日志记录,并在服务器端日志文件中找到了这一行:
7744 2021-06-09 03:58:37.691 debug1:执行命令:“c:\windows\system32\cmd.exe”/c “git-receive-pack '/Users/testing/testrepo.git'" 没有 pty

我手动尝试了 运行 git-recieve-pack '/Users/testing/testrepo.git',它也出现了同样的错误。但是,我随后尝试了 运行 git-receive-pack "/Users/testing/testrepo.git",它给出了
00bb0000000000000000000000000000000000000000 能力^{}报告状态报告-status-v2 delete-refs side-band-64k quiet atomic ofs-delta object-format=sha1 agent=git/2.32.0.windows.1 0000

唯一的区别是 " 而不是 '。这对 windows 服务器来说是不是很奇怪,还是我做错了什么?

事实证明这是我使用的 ssh 服务器的问题:https://github.com/PowerShell/Win32-OpenSSH/issues/752. One of the workarounds in the comments was to set the git receivepack and uploadpack commands to use powershell, but since I didn't want to change that for my global git config or have to do it for every repository I found a better solution. Following https://docs.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,这解决了 git-receive-pack.

的问题