You are currently viewing git cloneで「fatal: could not read Username for ‘https://github.com’: No such device or address」が表示された

git cloneで「fatal: could not read Username for ‘https://github.com’: No such device or address」が表示された

解決方法メモ

https://oauth2:${アクセストークン}@github.com/
のように、アクセストークンの前にoauth2、またはGitHubユーザー名を付与する

git cloneでエラーが発生

jenkinsで構築したCDを使用してデプロイを行ったところ、以下のエラーが発生しました

#13 1.008 fatal: could not read Username for 'https://github.com': No such device or address 

実行コマンドは

RUN git clone -b release https://${GITHUB_TOKEN}@github.com/sheltie-fusafusa/対象リポジトリ.git

という形で、アクセストークンを利用して認証を行い、対象リポジトリをクローンする仕組みでした

どうやらアクセストークンの前にoauth2、またはGitHubユーザー名を指定する方式が正しいようで、ブログ冒頭に記載した方式に変更したところクローンが成功しました

・・・今までoauth2の指定が無くても動いていたと勘違いしていたが、前回デプロイ時も同じ問題が起こり、サーバー上でファイルを直して、Gitにコミットしていなかったらしい

コメントを残す