Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Capistrano3到ubuntu 14.04 git错误_Git_Ubuntu_Capistrano3 - Fatal编程技术网

Capistrano3到ubuntu 14.04 git错误

Capistrano3到ubuntu 14.04 git错误,git,ubuntu,capistrano3,Git,Ubuntu,Capistrano3,由于ubuntu服务器上的git错误,我的capistrino检查失败 有这个日志吗 $ cap staging deploy:check --trace ** Invoke staging (first_time) ** Execute staging ** Invoke load:defaults (first_time) ** Execute load:defaults ** Invoke deploy:check (first_time) ** Execute deploy:check

由于ubuntu服务器上的git错误,我的capistrino检查失败

有这个日志吗

$ cap staging deploy:check --trace 
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO[bf639f43] Running /usr/bin/env mkdir -p /tmp/zarapp/ on 54.169.61.155
DEBUG[bf639f43] Command: /usr/bin/env mkdir -p /tmp/zarapp/
INFO[bf639f43] Finished in 1.368 seconds with exit status 0 (successful).
DEBUGUploading /tmp/zarapp/git-ssh.sh 0.0%
INFOUploading /tmp/zarapp/git-ssh.sh 100.0%
INFO[c06c1df0] Running /usr/bin/env chmod +x /tmp/zarapp/git-ssh.sh on 54.169.61.155
DEBUG[c06c1df0] Command: /usr/bin/env chmod +x /tmp/zarapp/git-ssh.sh
INFO[c06c1df0] Finished in 0.162 seconds with exit status 0 (successful).
** Execute git:check
DEBUG[d6b0ae0e] Running /usr/bin/env git ls-remote -h  on 54.169.61.155
DEBUG[d6b0ae0e] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/zarapp/git-ssh.sh /usr/bin/env git ls-remote -h  )
DEBUG[d6b0ae0e]     usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>]
DEBUG[d6b0ae0e]     
DEBUG[d6b0ae0e]                          [-q|--quiet] [--exit-code] [--get-url] [<repository> [<refs>...]]
DEBUG[d6b0ae0e] Finished in 0.462 seconds with exit status 129 (failed).
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 54.169.61.155: exit
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in `exit'
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in `block (4 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:27:in `block (3 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
SystemExit: exit
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in `exit'
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in `block (4 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:85:in `with'
/Library/Ruby/Gems/2.0.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:27:in `block (3 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Library/Ruby/Gems/2.0.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => git:check
它还表示相同的输出。capistrino 3是否运行了错误的命令语法或存在其他问题?

需要一个repo来操作

这意味着:

  • git ls remote-h
    将始终失败
  • 但这是可行的:

      git ls-remote -h /local/path/to/a/repo
      git ls-remote -h origin
    

正如:“”所指出的,capistrano版本不匹配(2.x与3.x)

见“

部署.rb是一个可以指定每个环境通用配置的地方,通常在这里指定存储库URL和要部署的用户


git ls remote
将使用
repo_url
执行。

谢谢Vonc,但我正在git repo内部运行此命令,如何告诉capistrino使用remote运行此命令?这很好地解决了我的问题。我已将其包含在答案中,以提高可见性。
  git ls-remote -h /local/path/to/a/repo
  git ls-remote -h origin
set :application, 'my app name'
    set :repo_url, 'git@example.com:me/my_repo.git'
    ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }