LoginSignup
0
0

More than 3 years have passed since last update.

Dockerfileイメージ作成時にプライベートリポジトリをGitHubからcloneする方法

Posted at

手順概要

GitHubのOAuthトークンを利用してcloneする。
https://docs.github.com/ja/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token

設定の流れ

  1. アカウントのSetteingsを開く
    スクリーンショット 2020-11-29 17.37.49.png

  2. 右のインベントリのDeveloper settingsを開く
    スクリーンショット 2020-11-29 18.04.28.png

  3. 右のインベントリからPersonal access tokensを選びGenerate new tokenを押す
    スクリーンショット 2020-11-29 18.07.23.png

  4. 適当なNote入力してrepo項目にチェックをして、最下部のGenerate tokenを押す
    スクリーンショット 2020-11-29 18.09.34.png

  5. 成功するとtokenが作成される
    スクリーンショット 2020-11-29 18.09.55.png

注意

・トークンの表示は一度のみなので必ずコピーすること(一応、同じ手順で再生成ができる)
・過去1年間使用されていないトークンを自動的に削除される

cloneする

https://[token]:x-oauth-basic@[githubのリポジトリURL]でアクセスできる。

例)token = aaa, リポジトリURL = github.com/demo/repo.git
git clone https://aaa:x-oauth-basic@github.com/demo/repo.git![スクリーンショット 2020-11-29 18.09.55.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/103954/78f45c36-6595-0954-d97f-cc362221d3a7.png)
0
0
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
0
0