How to solve: fatal: remote origin already exists

Share this article

Problem:

I have started working on git lately. An extremely organised way of version control. Since I am new with git, I keep messing with small things. One of the problem which I encountered was to get the following error:

fatal: remote origin already exists

when I am trying to run the following command:

git remote add origin [email protected]
:me/project.git

Reason:

Reason is explained in the error itself. Remote origin already exists i.e. its already been added.

Solution:

The way to solve it is to remove the origin previously added. Use the following command:

git remote rm origin

Hope it solved your problem also. Question, suggestions and feedback are welcomed. Enjoy :)

  • http://www.michalgonda.dk Michal Gonda

    What if I get this error afterwards?
    error: Could not remove config section ‘remote.origin’

    I already figure it out by:
    git remote set-url origin https:whatever

    I am just curious what could caused an error :)

  • http://twitter.com/Daniel_Holl Daniel Holl

    Thanks, that made my day so much easier.

    • https://computerandyou.net/ Abhishek Prakash

      @twitter-85601289:disqus You are welcome

  • Bhaskar

    That is so simple yet so helpful..thanks

    • https://computerandyou.net/ Abhishek Prakash

      You are welcome Bhaskar

  • Eliot Arntz

    Thanks for your help!

    • https://computerandyou.net/ Abhishek Prakash

      You are welcome Eliot

  • http://twitter.com/DMWoodall Dave Woodall

    This post was so easy to follow that I’ll use the time I planned on research to write a comment….

    Thank you!

    • https://computerandyou.net/ Abhishek Prakash

      Glad you find it helpful.

  • namrata chauhan

    Thank you for the solution
    it worked for me

    • http://computerandu.wordpress.com Abhishek Prakash Chaturvedi

      You are welcome..

  • http://itankur.wordpress.com AnkurG

    Thanks a lot! That solved it. I was going gaga a minute ago.

    • http://computerandu.wordpress.com Abhishek Prakash Chaturvedi

      You are welcome Ankur..

  • http://gravatar.com/esjaydee sdesapio

    Thank you!

    • http://computerandu.wordpress.com Abhishek Prakash Chaturvedi

      You are welcome…

  • http://abaltazar.org Alpha01

    This solved my problem :-)

    • http://computerandu.wordpress.com Abhishek Prakash Chaturvedi

      :)

  • http://meshfields.de nottinhill

    Thanks for this! I dented you.
    [trackback..] http://identi.ca/notice/80610976 [/trackback]

    • http://computerandu.wordpress.com Abhishek Prakash Chaturvedi

      You are welcome