How can I indicate the Git username and password in Capistrano's deploy.rb?

流过昼夜 提交于 2019-12-06 14:29:39

问题


I'm using github to store the repository, and I'm reading Deploy with Capistrano:

Remote caching will keep a local git repo on the server you’re deploying to and simply run a fetch from that rather than an entire clone".

Since the server where I'm deploying is "my" shared host, I must have git installed there.

When we do that, we normally define a git username and git password. Where should we place those on this deploy.rb file?

So far I have:

set :application, "mysite.dev"
set :user, "myuser"
set :repository, "git@github.com:gituser/gitproject.git"
role :web, "dev.mysite.pt"
set :deploy_to, "/home/mysite/www/dev"
set :use_sudo, false
set :scm, :git
set :branch, 'master'

#set :deploy_via, :copy
#set :copy_cache, true
#set :copy_exclude, %w(.git)

set :deploy_via, :remote_cache

task :create_symlinks, :roles => :web do
run "rm #{current_release}/public/.htaccess"
run "ln -s #{current_release}/production/.htaccess
#{current_release}/public/.htaccess"
end

after "deploy:finalize_update", :create_symlinks

Shouldn't we place, somewhere, the references to my shared host git password on the deploy.rb file somehow ?

I have the deploy server user:

set :user, "myuser"

Is this password the one from github user, or should we here put our shared host password?

set :scm_passphrase, "p@ssw0rd"  # The deploy user's password

回答1:


To use your local keys (from development machine) add this on the beginning of the script:

ssh_options[:forward_agent] = true

The set :user, 'myuser' is user name of the Linux box you are connecting to.



来源:https://stackoverflow.com/questions/5477708/how-can-i-indicate-the-git-username-and-password-in-capistranos-deploy-rb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!