この記事を作った動機

 単に Git で間違ったリモートを設定してしまったときの修正方法の記録をする。

やり方

# 必要に応じて変更したリモートリポジトリにあるブランチ名を確認すること
# リモート先に origin と指定した場合自動選択される。
git branch -a
# * main
#   remotes/origin/main

# Remote URL を間違える例
git remote add origin https://url.to.repo/userName/Receipt-OCR-to-CSV-with-PDF.git
git remote -v
# origin  https://url.to.repo/userName/Receipt-OCR-to-CSV-with-PDF.git (fetch)
# origin  https://url.to.repo/userName/Receipt-OCR-to-CSV-with-PDF.git (push)


# 正しい Remote URL に設定する例
git remote set-url origin gitea@192.168.1.9:userName/Receipt-OCR-to-CSV-with-PDF.git
git remote -v
# origin  gitea@192.168.x.x:userName/Receipt-OCR-to-CSV-with-PDF.git (fetch)
# rigin  gitea@192.168.x.x:userName/Receipt-OCR-to-CSV-with-PDF.git (push)

参考にしたサイトとか