2013-05-10 143 views
0

我想安装Capistrano部署我的项目与倍数git用户。在我工作的地方,没有(也不想拥有)一个通用的git用户,比如'git'。所以部署配置与运行'cap deploy'的用户相关。Capistrano - 部署与git共享存储库

,你可以在SE文件config.rb:

set :application, "mywebsite" 

set :repository, "ssh://#{scm_user}@myserver.com/repo.git" 

set :scm, :git 
set :scm_verbose, true 
set :deploy_via, :remote_cache 
set :git_enable_submodules, 1 

development.rb

set :deploy_to, "/var/www/html" 

set :user, "myuser" 
set :password, "mypassword" 
set :scm_passphrase, "mypassword" 

和猫〜/ .caprc文件:

set :scm_user, "myuser" 

它的工作原理为第一次部署的用户。当其他用户尝试在他们自己的机器上执行相同操作时,它不起作用。

错误与git有关。看来,Git是搭售是由git的克隆第一部署

的basicaly在这些行用户:

executing locally: "git ls-remote ssh://[email protected]/repo.git HEAD" 
* executing "if [ -d /var/www/html/shared/cached-copy ]; 
    then cd /var/www/html/shared/cached-copy 
    && git fetch origin 
    && git fetch --tags origin 
    && git reset --hard 88d6aa98c52babe9368cf2bed36741f0f0b93ff2 
    && git submodule init 
    && git submodule sync 
    && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] 
    && echo --recursive) 
    && git submodule update --init $GIT_RECURSIVE 
    && git clean -d -x -f; else git clone ssh://[email protected]/repo.git /var/www/html/shared/cached-copy && cd /var/www/html/shared/cached-copy 
    && git checkout -b deploy 88d6aa98c52babe9368cf2bed36741f0f0b93ff2 
    && git submodule init 
    && git submodule sync 
    && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] 
    && echo --recursive) 
    && git submodule update --init $GIT_RECURSIVE; fi" 

当我试图调试这个问题,我访问的服务器机THEOTHERUSER SSH帐号并输入git fetch --tags origin。它要求键入其他用户的passwork。

有谁知道我能做些什么来允许任何用户进行部署?

UPDATE:

什么需要做的:

set :remote, "#{scm_user}" 
set :branch, "master" 

http://ruby-doc.org/gems/docs/c/capistrano-edge-2.5.6/Capistrano/Deploy/SCM/Git.html

回答

1

如果更换什么库行吗?

set :repository, "ssh://myserver.com/repo.git" 
1

如果要将私有回购作为非通用用户进行部署,则必须设置ssh代理转发。这样你的SSH密钥也将在服务器上使用。

查看关于该主题的extensive GitHub documentation