発生したエラー
> gh repo clone my_private_repo
GraphQL: Resource not accessible by personal access token (repository.defaultBranchRef)
認証したはずなのにクローンできない
権限周りであることは分かるが, gh auth login
でアカウント認証したのでprivateリポジトリもクローンできると考えていた
発生した状況
- 仮想マシン上(ubuntu20.04)でghをインストール
-
gh auth login
でトークンを貼り付け認証 -
gh repo clone my_private_repo
でクローン
解決法
画面右下のSettings→Developer Settings
Fine-grained personal access tokensで作成したトークンを編集
PermissionsからRepository permissionsを選択し, Contentsのアクセス権限をRead and writeに変更
これでgh repo clone
ができるようになりました.