簡體   English   中英

Ruby 3.1.2 上的 SSHKit::Runner::ExecuteError

[英]SSHKit::Runner::ExecuteError on ruby 3.1.2

你好

導軌 7.0.3

紅寶石 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

謝謝,克里斯

您的:

git archive master

命令正在產生:

fatal: Not a valid object name

這表明沒有名為master的分支。 這可能是因為:

  • 根本沒有分支(還),或者
  • 主分支被命名為main ,就像大多數人現在所做的那樣,而不是使用master

檢查您的 Git 存儲庫以查看您是否有任何分支名稱(您不必分支名稱,但實際上除了在空存儲庫中之外沒有人會沒有它們),如果有,它們是什么。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM