できない.dev

git clone が「Repository not found」で失敗する(private/認証)

remote: Repository not found は、リポジトリ名が違うか、private リポジトリへのアクセス権・認証が通っていないときに出る。
URL の綴り、認証方式(PAT/SSH)、アカウントの所属を順に確認する。

公開: 更新:

症状できない
git ls-remote https://github.com/camo-maybe/this-repo-does-not-exist-9f3a.git
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/camo-maybe/this-repo-does-not-exist-9f3a.git/'

2026-09-26 に alpine/git(Git 2.54.0) で実際に打って取った出力。検証環境の詳細

要約

remote: Repository not found. は、GitHub が「そのリポジトリは存在しないか、あなたには見えない」と返している状態である。
public なら綴り違い、private なら認証・権限不足がほとんどである。
GitHub は private の存在自体を秘匿するため、権限が無くても 404 相当を返す(Troubleshooting cloning errors(新しいタブで開く))。
まず URL を確認し、次に認証が通っているかを見る。

実行例

空の資格情報で GitHub に接続した状態で git ls-remote を実行すると、実在しないリポジトリと実在する private リポジトリは、どちらも remote: Repository not found. と Authentication failed の 2 行で失敗した。
両者の出力で違うのは URL だけだった。
public の git/git だけが HEAD を返した。
資格情報を渡さず端末のプロンプトも無効にした場合は、ユーザー名を尋ねる段階で could not read Username になって止まった。

$ git ls-remote https://github.com/camo-maybe/this-repo-does-not-exist-9f3a.git
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/camo-maybe/this-repo-does-not-exist-9f3a.git/'
$ git ls-remote https://github.com/camo-maybe/dekinai-com.git
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/camo-maybe/dekinai-com.git/'
$ git ls-remote https://github.com/git/git.git | head -1
0f8e75abebff0877cae681a3d5ff31ac47f54220	HEAD
$ GIT_TERMINAL_PROMPT=0 git ls-remote https://github.com/camo-maybe/dekinai-com.git
fatal: could not read Username for 'https://github.com': terminal prompts disabled

— 2026-09-26 時点の出力

検証環境Git 2.54.0 / 2026-09-26 検証
検証日
実行環境
alpine/git Alpine Linux v3.24
バージョン
  • Git 2.54.0

この記事の「実行例」は、上記の環境で実際にコマンドを実行して得られた出力をそのまま掲載しています。 再現手順はリポジトリの検証スクリプトとして管理し、定期的に再実行して出力を更新しています。

解決策

1. URL を確認する

推測でタイプせず、リポジトリページから clone URL をコピペする。

git clone https://github.com/OWNER/REPO.git

2. HTTPS は PAT で認証する

パスワード認証は使えないため、Personal Access Token をパスワード欄に入力する(または資格情報ヘルパに保存する)。

git remote -v   # 現在の URL を確認
git remote set-url origin https://github.com/OWNER/REPO.git

3. SSH は鍵と SSO を確認する

鍵を登録し、疎通を確認する。
Organization が SAML SSO 必須なら、その鍵・トークンを Authorize する。

ssh -T git@github.com
# Hi USERNAME! ... と返れば認証成功

よくある原因

  1. 綴りかオーナーが違う。
    リポジトリ名やユーザー/Organization 名が間違っているか、別アカウントの所有でアクセス権が無い。
  2. 未認証のまま private リポジトリに接続している。
    ログインしていないか、権限の無い資格情報で接続している。
  3. 失効した PAT を使っている。
    HTTPS で、期限切れかスコープ不足のトークンを渡している(GitHub はパスワード認証を廃止している)。
  4. SSH 鍵を登録していない。
    鍵が GitHub に無いと匿名扱いになり、リポジトリが「存在しない」ように見える。