GitHub実践入門 ~Pull Requestによる開発の変革 (WEB+DB PRESS plus) という書籍を勉強中に、沼にハマったので記述しておきます。
GitHubをいじっている間に(何らかの原因があるはずなのですが)、リモートリポジトリのURLを変えてしまい、ぐちゃぐちゃで無効なURLとなってしまい、正しいリモートリポジトリにpushしようにも、意図しないリモートリポジトリのURL先にpushしてしまう事態に陥りました。
remote: Repository not found.
fatal: repository 'https://tomoki33kurita:tomoki8813@github.com/tomoki33kurita/Hello-world.git/' not found
と怒られていました。そこで、
~ $ git remote -v
をしてみると、
origin https://tomoki33kurita:tomoki8813@github.com/tomoki33kurita/Hello-world.git (fetch)
origin https://tomoki33kurita:tomoki8813@github.com/tomoki33kurita/Hello-world.git (push)
が表示されます。これらはどうやら、
.gitconfig
というファイルの
[remote "origin"]
url = https://tomoki33kurita:tomoki8813@github.com/tomoki33kurita/Hello-world.git
という部分を変更すると直るようです。
[remote "origin"]
url = https://github.com/tomoki33kurita/git-tr.git
正しいURLに修正することができました。