主要是从192.168.1.10机器远程获取github.com chlotte库(chlotte库为付费私人仓库),然后通过capistrano部署到192.168.1.50机器的/home/work/local目录;
遇到2个问题,请有经验的同学指导,谢谢!
1,capistrano deploy.rb 配置中已写明github账号与密码,执行cap deploy:update 时还需要输入github账号与密码;
2,执行cap deploy:update 时报错:fatal: could not read Username for '
https://github.com': No such device or address;
capistrano deploy.rb 配置:
[email protected]:/root/config$ cat deploy.rb
set :application, "chlotte"
set :repository, "https://github.com/chlotte/chlotte.git"
set :scm_username, "chlotte"
set :scm_password, "Chlotte0927"
set :scm, :git
set :deploy_to, "/home/work/local"
set :normalize_asset_timestamps, false
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "192.168.1.50" # Your HTTP server, Apache/etc
role :app, "192.168.1.50" # This may be the same as your `Web` server
role :db, "192.168.1.50", :primary => true # This is where Rails migrations will run
role :db, "192.168.1.50"
# if you're still using the script/reaper helper you will need
# these
http://github.com/rails/irs_process_scripts# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
[email protected]:/root/config$
[email protected]:/root/config$ cap deploy:setup
[email protected]:/root/config$ cap deploy:check
[email protected]:/root/config$ cap deploy:update
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote
https://github.com/chlotte/chlotte.git HEAD"
Username for '
https://github.com': chlotte
Password for '
https://[email protected]': command finished in 10703ms
* executing "git clone -q
https://github.com/chlotte/chlotte.git /home/work/local/releases/20150420033712 && cd /home/work/local/releases/20150420033712 && git checkout -q -b deploy f9e174f555bc75d9b767ed4a8202622cc5cf9fe8 && (echo f9e174f555bc75d9b767ed4a8202622cc5cf9fe8 > /home/work/local/releases/20150420033712/REVISION)"
servers: ["192.168.1.50"]
[192.168.1.50] executing command
** [192.168.1.50 :: err] fatal: could not read Username for '
https://github.com': No such device or address
command finished in 2107ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/work/local/releases/20150420033712; true"
servers: ["192.168.1.50"]
[192.168.1.50] executing command
command finished in 12ms
failed: "sh -c 'git clone -q
https://github.com/chlotte/chlotte.git /home/work/local/releases/20150420033712 && cd /home/work/local/releases/20150420033712 && git checkout -q -b deploy f9e174f555bc75d9b767ed4a8202622cc5cf9fe8 && (echo f9e174f555bc75d9b767ed4a8202622cc5cf9fe8 > /home/work/local/releases/20150420033712/REVISION)'" on 192.168.1.50
[email protected]:/root/config$