🌈

git リモートリポジトリのURLの変更

2024/03/02に公開

git remote set-urlコマンドでリモートリポジトリのURLを変更しました。

手順

  1. 現在設定されているリモートURLを確認する
git remote -v

origin	https://github.com/OWNER/REPOSITORY.git (fetch)
origin	https://github.com/OWNER/REPOSITORY.git (push)
  1. リモートURLを新しいURLに変更
git remote set-url origin https://github.com/OWNER/NEW-REPOSITORY.git
  1. 変更を確認する
git remote -v

origin	https://github.com/OWNER/NEW-REPOSITORY.git (fetch)
origin	https://github.com/OWNER/NEW-REPOSITORY.git (push)

参考

https://docs.github.com/ja/get-started/getting-started-with-git/managing-remote-repositories#changing-a-remote-repositorys-url

Discussion