git develop/master 推送失败
git push fails for develop/master
当尝试从本地 b运行ches master 推送或开发到相应的远程版本时,除了以下错误,我什么也没收到
$ git push --verbose
Pushing to server-name:repo-name/repo.git
error: failed to push some refs to 'server-name:repo-name/repo.git'
推其他b运行成功。我还可以从其他本地 b运行ches 推送到我们的 develop 和 master b运行ch,例如以下作品
git checkout master
git checkout -b master2
git push origin master2:master
我们的存储库是一个自托管的 GitLab 实例,我是它的所有者。因此,因为从不同的本地 b运行ch 推送成功,我认为这不是权限问题。我试图完全删除我的本地版本的 develop 和 master 并签出一个干净的版本,但无济于事。
编辑
正如评论中所问,我确实设置了 GIT_TRACE=2
和 运行 git 再次推送。这是完整的输出:
$ git push
16:41:50.788861 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
16:41:50.791871 git.c:444 trace: built-in: git push
16:41:50.800860 run-command.c:663 trace: run_command: unset GIT_PREFIX; ssh git@server-name 'git-receive-pack '\''repo-name/repo.git'\'''
16:41:51.703871 run-command.c:663 trace: run_command: .git/hooks/pre-push origin git@server-name:repo-name/repo.git
16:41:51.743860 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:41:51.744861 git.c:444 trace: built-in: git rev-parse --abbrev-ref HEAD
error: failed to push some refs to 'server-name:repo-name/repo.git'
16:41:51.893859 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
16:41:51.895871 git.c:444 trace: built-in: git config --bool core.sparseCheckout
我将输出与 git push
正在工作的机器进行比较,发现它在 运行 git-receive-pack
之后打印 Everything up-to-date
。所以我假设我的机器无法将接收到的引用与我的本地引用进行比较?
令人惊讶的是 git push
以
回应
error: failed to push some refs to 'server-name:repo-name/repo.git'
仅此而已。但是您的跟踪显示 Git 运行了一个钩子:
16:41:51.703871 run-command.c:663 trace: run_command: .git/hooks/pre-push origin git@server-name:repo-name/repo.git
pre-push hook 的手册告诉:
This hook is called by git-push[1] and can be used to prevent a push from taking place.
[...]
If this hook exits with a non-zero status, git push will abort without pushing anything. Information about why the push is rejected may be sent to the user by writing to standard error.
这就是你的情况。看起来唯一打印的错误是一个空行。
当尝试从本地 b运行ches master 推送或开发到相应的远程版本时,除了以下错误,我什么也没收到
$ git push --verbose
Pushing to server-name:repo-name/repo.git
error: failed to push some refs to 'server-name:repo-name/repo.git'
推其他b运行成功。我还可以从其他本地 b运行ches 推送到我们的 develop 和 master b运行ch,例如以下作品
git checkout master
git checkout -b master2
git push origin master2:master
我们的存储库是一个自托管的 GitLab 实例,我是它的所有者。因此,因为从不同的本地 b运行ch 推送成功,我认为这不是权限问题。我试图完全删除我的本地版本的 develop 和 master 并签出一个干净的版本,但无济于事。
编辑
正如评论中所问,我确实设置了 GIT_TRACE=2
和 运行 git 再次推送。这是完整的输出:
$ git push
16:41:50.788861 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
16:41:50.791871 git.c:444 trace: built-in: git push
16:41:50.800860 run-command.c:663 trace: run_command: unset GIT_PREFIX; ssh git@server-name 'git-receive-pack '\''repo-name/repo.git'\'''
16:41:51.703871 run-command.c:663 trace: run_command: .git/hooks/pre-push origin git@server-name:repo-name/repo.git
16:41:51.743860 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
16:41:51.744861 git.c:444 trace: built-in: git rev-parse --abbrev-ref HEAD
error: failed to push some refs to 'server-name:repo-name/repo.git'
16:41:51.893859 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
16:41:51.895871 git.c:444 trace: built-in: git config --bool core.sparseCheckout
我将输出与 git push
正在工作的机器进行比较,发现它在 运行 git-receive-pack
之后打印 Everything up-to-date
。所以我假设我的机器无法将接收到的引用与我的本地引用进行比较?
令人惊讶的是 git push
以
error: failed to push some refs to 'server-name:repo-name/repo.git'
仅此而已。但是您的跟踪显示 Git 运行了一个钩子:
16:41:51.703871 run-command.c:663 trace: run_command: .git/hooks/pre-push origin git@server-name:repo-name/repo.git
pre-push hook 的手册告诉:
This hook is called by git-push[1] and can be used to prevent a push from taking place.
[...]
If this hook exits with a non-zero status, git push will abort without pushing anything. Information about why the push is rejected may be sent to the user by writing to standard error.
这就是你的情况。看起来唯一打印的错误是一个空行。