如何在 Capistrano 的 deploy.rb 中指示 Git 用户名和密码?
我正在使用 github 来存储存储库,并且正在阅读 使用 Capistrano 部署:
远程缓存将在您要部署到的服务器上保留本地 git 存储库,并且简单地 从中运行提取而不是整个克隆”。
由于我要部署的服务器是“我的”共享主机,所以我必须在那里安装 git。
当我们这样做时,我们通常会定义一个git 用户名和 git 密码。 我们应该将它们放置在这个deploy.rb 文件中的什么位置?
到目前为止,我已经:
set :application, "mysite.dev"
set :user, "myuser"
set :repository, "[email protected]: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
我们不应该以某种方式将对我的共享主机 git 密码的引用放在部署.rb 文件上吗?
我有部署服务器用户:
set :user, "myuser"
这个密码是来自 github 的密码吗?用户,或者我们应该在这里输入我们的共享主机密码?
set :scm_passphrase, "p@ssw0rd" # The deploy user's password
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, "[email protected]: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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使用本地密钥(来自开发计算机),请将其添加到脚本的开头:
set :user, 'myuser'
是您要连接的 Linux 机器的用户名。To use your local keys (from development machine) add this on the beginning of the script:
The
set :user, 'myuser'
is user name of the Linux box you are connecting to.