2013-01-11 5 views
1

개인 Bitbucket 저장소 인 Capistrano와 mercurial을 사용하여 Amazon EC2 인스턴스에 코드를 배포하려고합니다.bitbucket 저장소의 Capistrano 배포 코드에서 "인증에 실패했습니다."

내 개발 상자에서 cap deploy:setup을 성공적으로 실행했습니다.

그런 다음 cap deploy:cold을 실행하려고했습니다. 내가 올바르게 한 bitbucket 암호를 입력하라는 메시지가 표시되었지만 "인증에 실패했습니다"라는 오류 메시지가 나타납니다. 결과적으로, 코드를 배포하려고 시도한 머신은 bitbucket 저장소에서 코드를 "복제"할 수 없었습니다.

이 세부 사항에 무슨 일이 있었는지입니다 : 내가 수동으로 명령 행에서이 시도

set :application, "my_project" 
set :repository, "https://[email protected]/bitbucket_user_id/my_project" 
set :keep_releases, 4 

set :scm, :mercurial 
set :scm_username, "bitbucket_user_id" 
default_run_options:pty = true 
set :scm_prefer_prompt, :true 
set :scm_verbose, :true 

set :deploy_to, "/home/ec2-user/#{application}" 
set :deploy_via, :remote_cache 

set :user, "ec2-user" 
set :use_sudo, false 

namespace :deploy do 
    desc "Gracefully restarting unicorn" 
    task :restart, :roles => :app do 
     run "sudo /etc/init.d/start_script upgrade" 
    end 
    task :start, :roles => :app do 
     run "sudo /etc/init.d/start_script start" 
    end 

    task :stop, :roles => :app do 
     run "sudo /etc/init.d/start_script stop" 
    end 

    task :link, :roles => :app do 
     run "mkdir -p #{shared_path}/images" 
     run "ln -nfs #{shared_path}/images #{release_path}/tmp/images" 
    end 
end 

% cap deploy:cold 
triggering load callbacks 
* 2013-01-10 18:44:07 executing 'production' 
triggering start callbacks for 'deploy:cold' 
* 2013-01-10 18:44:07 executing 'multistage:ensure' 
* 2013-01-10 18:44:07 executing 'deploy:cold' 
* 2013-01-10 18:44:07 executing 'deploy:update' 
** transaction: start 
* 2013-01-10 18:44:07 executing 'deploy:update_code' 
updating the cached checkout on all servers 
executing locally: "hg log --verbose -r default --template \"{node|short}\"" 
command finished in 797ms 
* executing "if -d /home/ec2-user/my_project/shared/cached-copy ; then hg pull  --verbose --repository /home/ec2-user/my_project/shared/cached-copy https://[email protected]/bitbucket_user_id/my_project && hg update --verbose --repository /home/ec2-user/my_project/shared/cached-copy --clean 2ec0193d60ff; else hg clone --verbose --noupdate https://[email protected]/bitbucket_user_id/my_project /home/ec2-user/my_project/shared/cached-copy && hg update --verbose --repository /home/ec2-user/my_project/shared/cached-copy --clean 2ec0193d60ff; fi" 
servers: "ec2-123-456-78-999.compute-1.amazonaws.com" 
ec2-123-456-78-999.compute-1.amazonaws.com executing command 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out http authorization required 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out realm: Bitbucket.org HTTP 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out user: bitbucket_user_id 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out password: 
hg password: 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out 
** ec2-123-456-78-999.compute-1.amazonaws.com :: out abort: authorization failed 
command finished in 5410ms 
*** deploy:update_code rolling back 
* executing "rm -rf /home/ec2-user/my_project/releases/20130110184415; true" 
servers: "ec2-123-456-78-999.compute-1.amazonaws.com" 
ec2-123-456-78-999.compute-1.amazonaws.com executing command 
command finished in 431ms 
failed: "sh -c 'if -d /home/ec2-user/my_project/shared/cached-copy ; then hg pull --verbose --repository /home/ec2-user/my_project/shared/cached-copy https://[email protected]/bitbucket_user_id/my_project && hg update --verbose --repository /home/ec2-user/my_project/shared/cached-copy --clean 2ec0193d60ff; else hg clone --verbose --noupdate https://[email protected]/bitbucket_user_id/my_project /home/ec2-user/my_project/shared/cached-copy && hg update --verbose --repository /home/ec2-user/my_project/shared/cached-copy --clean 2ec0193d60ff; fi'" on ec2-123-456-78-999.compute-1.amazonaws.com 

이 내 카피 스트라 노 deploy.rb 파일입니다

ssh [email protected] "hg clone --verbose --noupdate https://[email protected]/bitbucket_user_id/my_project /home/ec2-user/my_project/shared/cached-copy" 

및 I 있어 (비트 버킷 암호를 묻지 않음)

abort: http authorization required 

나는

ssh -t [email protected] "hg clone --verbose --noupdate https://[email protected]/bitbucket_user_id/my_project /home/ec2-user/my_project/shared/cached-copy" 

을 시도하고 일했다.

나는 카피 스트라 노 SSH를 사용 믿습니다 그래서

default_run_options[:pty] = true 

작동한다 (의사 TTY 내 deploy.rb에서이 라인으로 설정하여), 그러나 왜 카피 스트라 노 작동하지 않습니다?

누군가가 도와 드릴 수 있습니까?

감사합니다.

답변

1

나는이 비슷한 문제가 발생하고이 질문을보고 그것을 해결되었습니다 Capistrano deploy failed after moving to bitbucket.org

회답이 사람이 그들의 Bitbucket에 배포 키를 만든 것으로 확인 제안했다. BitBucket 레포에서 설정 휠을 클릭하고 왼쪽 사이드 바에서 "배포 키"를 클릭하십시오 : 배포 키를 사용하여이 리포지토리에 대한 읽기 전용 액세스 권한을 얻으십시오.

당신이 SSH 키를 설정하는 방법을 모르는 경우

, 여기의 Bitbucket의 가이드를 읽어 :이 도움이 https://confluence.atlassian.com/pages/viewpage.action?pageId=270827678

희망을!

관련 문제