86
56

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gitのエラー fatal: remote origin already existsの解決方法

Last updated at Posted at 2018-06-11

勉強になったサイト

git エラーの内容

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

なぜこのようなエラーになるのか。ということで検索したら、以下のページを見て解決できた。
http://pyoonn.hatenablog.com/entry/2014/10/29/191744

一度originを削除し、再度originを登録すればよい。

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

自分の場合は、githubのリモートリポジトリをローカルリポジトリに反映させたかったので、この後に以下の命令を行った。

$ git pull origin master
86
56
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
86
56

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?