SSHKit::Runner::ExecuteError on ruby 3.1.2



Hi

轨道7.0.3

ruby 3.1.2

服务器(生产/暂存)和存储库都在我自己的linux上。

手动地,我可以ssh到生产服务器,然后从那里ssh到存储库服务器。

来自生产机器的git clone也做他的工作(手动,用于测试)。

我在生产机器上做了eval "${ssh-agent}"ssh-add ~/.ssh/id_rsa,运行良好,但没有改变

问题

cap staging deploy --trace

中的结果

[...]
00:01 git:update
01 git remote set-url origin repo-get@my-server.ch:/repos/pro-cnc/cncoffice.git
✔ 01 cncoffice@my-customer.com 0.098s
02 git remote update --prune
02 Fetching origin
✔ 02 cncoffice@my-customer.com 0.268s
** Execute git:create_release
00:01 git:create_release
01 mkdir -p /srv/office/releases/20220701115330
✔ 01 cncoffice@my-customer.com 0.100s
02 git archive master | /usr/bin/env tar -x -f - -C /srv/office/releases/20220701115330
02 fatal: Not a valid object name
02 tar: This does not look like a tar archive
02 tar: Exiting with failure status due to previous errors
#<Thread:0x000000011398dc08 /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as cncoffice@my-customer.com: git exit status: 2 (SSHKit::Runner::ExecuteError)
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/command.rb:97:in `exit_status=': git exit status: 2 (SSHKit::Command::Failed)
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:170:in `execute_command'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
from <internal:kernel>:90:in `tap'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/git.rb:83:in `git'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/git.rb:73:in `archive_to_release_path'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:57:in `block (5 levels) in eval_rakefile'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:92:in `within'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:55:in `block (4 levels) in eval_rakefile'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:100:in `with'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:54:in `block (3 levels) in eval_rakefile'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
from /Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as cncoffice@my-customer.com: git exit status: 2
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
Caused by:
SSHKit::Command::Failed: git exit status: 2
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/command.rb:97:in `exit_status='
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
<internal:kernel>:90:in `tap'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/git.rb:83:in `git'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/git.rb:73:in `archive_to_release_path'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:57:in `block (5 levels) in eval_rakefile'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:92:in `within'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:55:in `block (4 levels) in eval_rakefile'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:100:in `with'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/capistrano-3.17.0/lib/capistrano/scm/tasks/git.rake:54:in `block (3 levels) in eval_rakefile'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
/Users/dev/.rvm/gems/ruby-3.1.2/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:create_release
The deploy has failed with an error: Exception while executing as cncoffice@my-customer.com: git exit status: 2
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
** Invoke deploy:failed (first_time)
** Execute deploy:failed
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

DEBUG [ba3e6dbe] Command: if test ! -d /srv/office-staging/repo; then echo "Directory does not exist '/srv/office-staging/repo'" 1>&2; false; fi
DEBUG [ba3e6dbe] Finished in 0.095 seconds with exit status 0 (successful).
INFO [3174d347] Running /usr/bin/env git remote set-url origin repo-get@sedlmair.ch:/repos/pro-cnc/cncoffice.git as cncoffice@office.procnc.ch
DEBUG [3174d347] Command: cd /srv/office-staging/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-7f405f262ce173c371af.sh" ; /usr/bin/env git remote set-url origin repo-get@sedlmair.ch:/repos/pro-cnc/cncoffice.git )
INFO [3174d347] Finished in 0.099 seconds with exit status 0 (successful).
INFO [f60a0654] Running /usr/bin/env git remote update --prune as cncoffice@office.procnc.ch
DEBUG [f60a0654] Command: cd /srv/office-staging/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-7f405f262ce173c371af.sh" ; /usr/bin/env git remote update --prune )
DEBUG [f60a0654]   Fetching origin
INFO [f60a0654] Finished in 0.267 seconds with exit status 0 (successful).
DEBUG [95047571] Running if test ! -d /srv/office-staging/repo; then echo "Directory does not exist '/srv/office-staging/repo'" 1>&2; false; fi as cncoffice@office.procnc.ch
DEBUG [95047571] Command: if test ! -d /srv/office-staging/repo; then echo "Directory does not exist '/srv/office-staging/repo'" 1>&2; false; fi
DEBUG [95047571] Finished in 0.099 seconds with exit status 0 (successful).
INFO [bd721b6b] Running /usr/bin/env mkdir -p /srv/office-staging/releases/20220701123555 as cncoffice@office.procnc.ch
DEBUG [bd721b6b] Command: cd /srv/office-staging/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-7f405f262ce173c371af.sh" ; /usr/bin/env mkdir -p /srv/office-staging/releases/20220701123555 )
INFO [bd721b6b] Finished in 0.106 seconds with exit status 0 (successful).
INFO [31b8821b] Running /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /srv/office-staging/releases/20220701123555 as cncoffice@office.procnc.ch
DEBUG [31b8821b] Command: cd /srv/office-staging/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-7f405f262ce173c371af.sh" ; /usr/bin/env git archive master | /usr/bin/env tar -x -f - -C /srv/office-staging/releases/20220701123555 )
DEBUG [31b8821b]   fatal: Not a valid object name
DEBUG [31b8821b]   tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

谢谢,Chris

您的:

git archive master

命令正在生成:

fatal: Not a valid object name

这表示没有名为master的分支。这可能是因为:

  • 根本没有分支(目前),或者
  • 主分支被命名为main,就像大多数人现在所做的那样,而不是使用master

检查你的Git存储库,看看你是否有分支名称(你不必有分支名称,但实际上除了空的存储库之外,没有人没有分支名称),如果有,它们是什么。

最新更新