简体   繁体   中英

SSHKit::Runner::ExecuteError on ruby 3.1.2

Hi

rails 7.0.3

ruby 3.1.2

both servers (production / staging) and the repository are on my own linux.

manually, i can ssh into production server and ssh from there to the repository server.

git clone from the production machine also does his work (manually, for testing).

i've done a eval "${ssh-agent}" and ssh-add ~/.ssh/id_rsa on the production machine which runs fine but changes nothing

The Problem

cap staging deploy --trace

results in

[...]

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

Thanks, Chris

Your:

git archive master

command is producing:

fatal: Not a valid object name

This indicates that there's no branch named master . That's likely because either:

  • there are no branches at all (yet), or
  • the main branch is named main , as most people do now instead of using master .

Check your Git repository to see whether you have any branch names at all (you don't have to have branch names, but practically nobody goes without them except in empty repositories) and if so, what they are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM