Capistrano + Git:生产服务器的本地存储库

Mar*_*man 18 git deployment capistrano ruby-on-rails

我正在尝试为我的应用程序"部署:冷".git仓库是我的部署服务器本地的(即我只有一台服务器用于所有东西,我不在github上托管我的代码).

这是成绩单(将我的应用名称替换为"myapp"以获取隐私)

  * executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote /home/mrichman/git/myapp.git master"
fatal: '/home/mrichman/git/myapp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/myapp.com/releases/20100218203108; true"
    servers: ["myapp.com"]
Password:
    [myapp.com] executing command
    command finished
Command git ls-remote /home/mrichman/git/myapp.git master returned status code 32768
Run Code Online (Sandbox Code Playgroud)

这是我的deploy.rb:http://pastie.org/831424

我也试过了

set :repository, "deploy@localhost:/home/mrichman/git/myapp.git"
Run Code Online (Sandbox Code Playgroud)

但这给了我

ssh: connect to host localhost port 22: Connection refused
Run Code Online (Sandbox Code Playgroud)

任何想法都表示赞赏.

小智 16

刚遇到同样的问题.关键是不要使用deploy_via复制,而是设置:local_repository

应将其设置为用于从开发计算机/笔记本电脑访问存储库的URL.

所以我的

set :repository, "file:///srv/git/myapp.git"
set :local_repository, "nameOfHostFromSSHConfig:/srv/git/myapp.git"
Run Code Online (Sandbox Code Playgroud)

似乎有效.请记住,然后删除deploy_via副本行.

  • 我使用`set:repository,"/ home /#{user} /path/to/repo.git"`而不是`file:/// ...`行,它就像怪异的魔法!谢谢 (2认同)