0
0

More than 1 year has passed since last update.

GraphQL: Resource not accessible by personal access token (repository.defaultBranchRef)の解決法

Last updated at Posted at 2023-08-27

発生したエラー

> 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
スクリーンショット 2023-08-28 1.09.43.png

Fine-grained personal access tokensで作成したトークンを編集
スクリーンショット 2023-08-28 1.12.55.png

PermissionsからRepository permissionsを選択し, Contentsのアクセス権限をRead and writeに変更
スクリーンショット 2023-08-28 1.15.09.png

これでgh repo cloneができるようになりました.

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