👌

[GitHub] httpsでremote: Repository not found.となった時の対応方法

2022/06/09に公開

git push したら怒られた

$ git push -u origin main
remote: Repository not found.
fatal: repository 'https://github.com/{ユーザ名}/{リポジトリ名}.git/' not found

解決

git remotePersonal access tokens付きで設定し直す

Personal access tokensについて詳しくはこちら

https://github.com/settings/tokens

現状を確認

$ git remote -v
origin  https://github.com/{ユーザ名}/{リポジトリ名}.git (fetch)
origin  https://github.com/{ユーザ名}/{リポジトリ名}.git (push)

git remote rm originで一旦削除して設定し直す

$ git remote rm origin
$ git remote add origin https://{ユーザ名}:{tokens}@github.com/{ユーザ名}/{リポジトリ名}.git

再度git push

$ git push -u origin main
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 4 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (17/17), 8.99 KiB | 242.00 KiB/s, done.
Total 17 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/{ユーザ名}/{リポジトリ名}.git
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.

できましたー

Discussion