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

我正在尝试为我的应用程序“部署:冷”。 git repo对我的部署服务器是本地的(即我只有一台服务器用于所有东西而且我没有在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 

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

我也试过了

 set :repository, "deploy@localhost:/home/mrichman/git/myapp.git" 

但这给了我

 ssh: connect to host localhost port 22: Connection refused 

任何想法都表示赞赏。

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

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

所以我的

 set :repository, "file:///srv/git/myapp.git" set :local_repository, "nameOfHostFromSSHConfig:/srv/git/myapp.git" 

似乎工作了。 请记住,然后删除deploy_via副本行。

以您要部署的站点的用户身份登录,并尝试查看您的用户是否有权访问该目录:

ls -la /home/mrichman/git/myapp.git

如果您收到Permission denied错误,那么您必须确保在存储库的封闭目录上设置允许部署脚本访问文件的权限。

确保您已经编写了正确的git repo,并且注重案例敏感的写作! (我遇到了同样的问题,它刚刚解决了)

我的问题实际上与已知主机问题有关。 我所要做的就是确保远程git服务器在我的已知主机中(第一次尝试SSH进入它会提示你自己添加它),它就像一个魅力。

如果设置了local_repository ,则Capistrano将使用部署服务器中的respository值和开发服务器中的local_respository值。 或类似的东西。

我的配置工作如下:

 set :repository, "/home/#{user}/path/to/repo.git" set :local_repository, "myserver.com:path/to/repo.git"