B
B
bmalets2015-04-01 18:50:40
git
bmalets, 2015-04-01 18:50:40

Remote origin already exists error, how to fix?

How to add a remote origin branch, and if it already exists, then do not add it, with one command?
+ what's the difference between:

  • git remote add origin [email protected]
  • git remote set-url origin [email protected]
  • git remote set-url --add origin [email protected]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bmales, 2015-04-02
@bmales

In my case, this error appeared due to the fact that this branch already existed and the url was the same.
Therefore, this "mixture" of two commands helped me:
That is, if the branch exists - just update the url, if not - then add it.
More information can be found here and here
What is the magic of >/dev/null 2>&1 read here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question