0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Github CLIでの "Repository not found." の解決方法

Posted at

環境

  • Git 2.39.5
  • GitHub CLI (gh) 2.79.0

状況

  1. GitHubで Pesonal Access Token (以下"PAT") を発行し、gh auth loginでHTTPS認証
  2. gh repo create ...でリポジトリを作成
  3. pushしようとするとRepository not found.と言われる

問題点

ブラウザで確認すると、リポジトリは正しく作成されているにもかかわらず、CLIでは Not found. と言われる。
→→ CLIで認証に失敗している

解決策

originのURLにPATを追記

git remote -v
# デフォルトの https://github.com/ユーザ/リポジトリ が設定されている

# ↓
git remote set-url origin https://{発行したPAT}@github.com/ユーザ/リポジトリ
# github.comの前にトークンを入れることで認証に成功

なお、PATはgh auth tokenで確認できる。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?