LoginSignup
2
1

More than 3 years have passed since last update.

fatal: remote origin already existsのエラーで怒られたとき

Last updated at Posted at 2020-09-26

リモートリポジトリをローカルリポジトリに紐付けしようとしたら
以下のエラーが!!

$ git remote add origin git@github.com:com/ユーザー名/リポジトリ名.git
fatal: remote origin already exists.

要は、既に紐付き先があるから浮気しないでくれって感じなのでそれに消えてもらって、再度登録をし直せばいいとのこと。

そこで念のためにどのリポジトリに紐付いてるかを確認するために

git remote -v

を入力。

origin  git@github.com:~(fetch)
origin  git@github.com:~(push)


すると今の紐付け先が出てくるので、削除するために

git remote rm origin

を入力。
そしてもう一度

git remote -v

を入力して削除されたかの確認。
削除されてたら何も出てきません。

そして、

git remote add origin git@github.com:ユーザ名/リポジトリ名.git

を入力して、新しいリポジトリの紐付け完了。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1