Capistrano从Git HTTP repo部署

Ain*_*vri 5 git deployment capistrano ruby-on-rails http

有没有人通过HTTP从Git存储库部署Capistrano?

以下deploy.rb无效:

set :repository,  'http://git.repository-domain.com:4442/git/repo.git'
set :scm_username, "git_username"
set :scm_password, "git_password"
set :scm, :git
Run Code Online (Sandbox Code Playgroud)

如果您通过以下方式传递存储库,它仍在工作:

set :repository,  'http://git_username:git_password@git.repository-domain.com:4442/git/repo.git'
Run Code Online (Sandbox Code Playgroud)

只要用户名或密码没有特殊字符,后者才有效.对这些字符进行URL编码将导致失败.

更新:在https://github.com/capistrano/capistrano/issues/384的故障单中可以更准确地描述问题

Ain*_*vri 16

Capistrano Git HTTPS身份验证将在Capistrano 3中解决,您可以在其中设置存储库及其凭据:

set :repo_url, 'https://git.repository-domain.com:4442/git/repo.git'
set :git_https_username, 'username'
set :git_https_password, 'password'
Run Code Online (Sandbox Code Playgroud)

此外,在Capistrano 3中已经可以使用的是存储库URL中的用户名:密码,即使密码包含特殊字符:

set :repo_url, 'https://ain:3490jL?a@git.repository-domain.com:4442/git/repo.git'
Run Code Online (Sandbox Code Playgroud)

有关更多最新信息,请参阅https://github.com/capistrano/capistrano/tree/v3

  • 它是 git_http_username 和 git_http_password,根据 https://github.com/capistrano/capistrano/search?q=git_http_username&unscoped_q=git_http_username,没有“s” (2认同)