2014-09-28 74 views
1

由於ubuntu服務器上的git錯誤,我的capistrino檢查失敗。Capistrano 3 to Ubuntu 14.04 git error

得到這個日誌

$ 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 

我認爲這是對server.I GIT中的錯誤已經更新,但沒有仍然沒有成功。 我ssh到服務器,並嘗試運行git ls-remote -h命令直接

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>...]] 

也說了同樣的輸出。 capistrino 3是否運行錯誤的命令語法或者有其他問題?

+0

這解決了我的問題http://stackoverflow.com/questions/23938297/capistrano-git-ls-remote-h-doesnt-have-the-git-url – Hemc 2014-09-28 09:42:26

+0

優秀。我已經將它包含在答案中以提高可見性。 – VonC 2014-09-28 09:53:09

回答

3

git ls-remote需要回購操作。

這意味着:

  • git ls-remote -h將永遠無法
  • 但是這會工作:

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

由於OP Hemccomments: 「capistrano - git ls-remote -h doesn't have the git url」 確實婆詮釋出到Capistrano的版本不匹配(2.X與3.X)

請參見「Preparing Your Application

deploy.rb是其中可以指定共同的每個環境的結構的地方,通常存儲庫URL和要部署的用戶在此處指定。

set :application, 'my app name' 
    set :repo_url, '[email protected]:me/my_repo.git' 
    ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } 

git ls-remote將使用repo_url其執行。

+0

謝謝Vonc,但我在git倉庫裏面運行這個命令,我怎麼能告訴capistrino遠程運行這個命令? – Hemc 2014-09-28 08:49:26