使用 capistrano 进行 https 部署

https deployment with capistrano

我正在尝试使用 capistrano 在本地服务器上部署 rails 应用程序。 但是,服务器无法通过 ssh 连接到外部(互联网),所以我无法在部署文件中使用 git@bitbucket.org:sample/repo.git 作为 repo url。相反,我使用 https://user@bitbucket.org:sample/repo.git。但是当我 运行 cap production deploy 我收到无效的用户名或密码错误。 下面是我的 deploy.rb 文件

lock "3.8.1"

set :scm, :git
set :application, "sample"
set :scm_username, "user"
set :scm_password, "password"
set :repo_url, "https://user@bitbucket.org:sample/repo.git"

set :branch, "production"

set :deploy_to, "/home/deploy/sample"

我可以让 cap 要求我输入密码吗(如果它不使用 scm_password 字段。

变化:

set :scm_username, "user"
set :scm_password, "password"

set :git_http_username, "user"
set :git_http_password, "password"

此外,我认为您可以将 username/password 放在 URL 中,例如:

set :repo_url, "https://user:password@bitbucket.org:sample/repo.git"