Git 拉取请求在通过 ssh 启动时出错(从 RHEL 到 Windows Server 2012)

Git pull request results in error when initiated via ssh (from RHEL to Windows Server 2012)

我的目标基本上是:

我想(自动)更新本地 git-存储库(在 windows-服务器上),当更改被推送到原始存储库(在 RHEL 服务器上)时。 我想使用本地存储库中的 'git pull' 命令来防止安装额外的软件,例如。 rsync.

我从 bash 发出命令如下:

ssh <user>@<server(windows)> "cd \path\to\repository && git pull"

回复:

dup() in/out/err failed

fatal: Could not read from remote repository. Please make sure you have the right access rights and the repository exists.

当我使用同一用户在 windows 服务器上发出命令 "git pull" 时,没有任何问题。

两个 git 版本都是最新的,不太可能出现权限问题,因为我使用同一用户发出命令。

这是 GIT_TRACE 打印输出

成功:

14:55:17.022804 exec_cmd.c:236          trace: resolved executable dir:C:/Program Files/Git/mingw64/bin
14:55:17.038415 git.c:344               trace: built-in: git pull
14:55:17.038415 run-command.c:640       trace: run_command: git fetch --update-head-ok
14:55:17.054036 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:55:17.054036 git.c:344               trace: built-in: git fetch --update-head-ok
14:55:17.054036 run-command.c:640       trace: run_command: unset GIT_DIR GIT_PREFIX; ssh <user>@<address>.system.local 'git-upload-pack '\''/opt/iam_repo/entwicklung/apa225543'\'''
14:58:06.232453 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:58:06.232453 git.c:344               trace: built-in: git pull
14:58:06.232453 run-command.c:640       trace: run_command: git fetch --update-head-ok
14:58:06.248078 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.248078 git.c:344               trace: built-in: git fetch --update-head-ok
14:58:06.248078 run-command.c:640       trace: run_command: unset GIT_DIR GIT_PREFIX; ssh <user>@<address>.system.local 'git-upload-pack '\''/opt/iam_repo/entwicklung/apa225543'\'''
14:58:06.435864 run-command.c:640       trace: run_command: git rev-list --objects --stdin --not --all --quiet
14:58:06.435864 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.435864 git.c:344               trace: built-in: git rev-list --objects --stdin --not --all --quiet
14:58:06.482460 run-command.c:640       trace: run_command: git unpack-objects --pack_header=2,3
14:58:06.482460 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.482460 git.c:344               trace: built-in: git unpack-objects --pack_header=2,3
14:58:06.498077 run-command.c:640       trace: run_command: git rev-list --objects --stdin --not --all --quiet
14:58:06.498077 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.513704 git.c:344               trace: built-in: git rev-list --objects --stdin --not --all --quiet
14:58:06.513704 run-command.c:1556      run_processes_parallel: preparing to run up to 1 tasks
14:58:06.513704 run-command.c:1588      run_processes_parallel: done
14:58:06.513704 run-command.c:640       trace: run_command: git gc --auto
14:58:06.529335 exec_cmd.c:236          trace: resolved executable dir:C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.529335 git.c:344               trace: built-in: git gc --auto
14:58:06.529335 run-command.c:640       trace: run_command: git merge FETCH_HEAD
14:58:06.544974 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.544974 git.c:344               trace: built-in: git merge FETCH_HEAD
14:58:06.560579 run-command.c:640       trace: run_command: git gc --auto
14:58:06.560579 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:58:06.560579 git.c:344               trace: built-in: git gc --auto

不成功:

14:59:42.561721 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:59:42.561721 git.c:344               trace: built-in: git pull
14:59:42.561721 run-command.c:640       trace: run_command: git fetch --update-head-ok
14:59:42.561721 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:59:42.577343 git.c:344               trace: built-in: git fetch --update-head-ok
14:59:42.577343 run-command.c:640       trace: run_command: unset GIT_DIR GIT_PREFIX; ssh <user>@<address>.system.local 'git-upload-pack '\''/opt/iam_repo/entwicklung/apa225543'\'''
15:19:32.440504 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
15:19:32.440504 git.c:344               trace: built-in: git pull
15:19:32.440504 run-command.c:640       trace: run_command: git fetch --update-head-ok
15:19:32.456129 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
15:19:32.456129 git.c:344               trace: built-in: git fetch --update-head-ok
15:19:32.456129 run-command.c:640       trace: run_command: unset GIT_DIR GIT_PREFIX; ssh <user>@<address>.system.local 'git-upload-pack '\''/opt/iam_repo/entwicklung/apa225543'\'''

好像就到此为止了。

我有 IBM Secure Shell 运行。用 cygwin open ssh 替换它,现在它工作正常。