LoginSignup
3
3

More than 5 years have passed since last update.

CapistranoでGitHubにアクセスする際のネットワークプロトコルをhttpsにする

Posted at

Capistranoからデプロイする際に、SSHプロトコルを使ってGitリポジトリのコードを取得するのが一般的かと思いますが、HTTPプロトコルで取得することも可能です。

あらかじめPersonal access tokenを発行しておきます。

Capistranoを実行する環境で環境変数に発行したPersonal access tokenを設定し、デプロイスクリプト側で次のようにrepo_urlを設定します。この例では環境変数GITHUB_TOKENに設定しています。

config/deploy.rb
set :repo_url, "https://#{ENV["GITHUB_TOKEN"]}@github.com/<organization>/<repository>.git"

以前はgit_https_usernamegit_https_passwordで設定可能でしたが、Capistrano 3.1から廃止されていました。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3