When I try to play my machine repository in the Google cloud repository I get an error saying : remote origin already exists

Asked

Viewed 51 times

-1

I have an application already created, I’m using Google cloud and I also have a repository on github.

When I try to play my machine repository in the Google cloud repository I get an error saying:

remote origin já existe.

How can I fix this?

1.{   dimal@DESKTOP-00VTGS0 MINGW64 ~/Desktop/api-rest (initial)
-----> essa é minha branch   } 
2.{   $ git remote add origin 35.199.127.153:repo-api
-----> esse é meu comando    }
3.{   fatal: remote origin already exists.
-----> esse é o erro         }             
  • remote add serve to add in your settings a remote repository, vc passes a name any and the URL of it (in case, the name you gave is "origin" and the URL is "35.199.etc..". The error only says that there is already a remote in your settings called "origin" - you can see what is its URL with git remote show origin (or git remote -v to show all the remotes), if it is the URL you want, everything is already right. If it’s not the URL you want, add it under a different name than "origin"

1 answer

0

This is because there is already a remote with the name origin. You can simply swap the remote URL using:

git remote set-url origin <sua-url>

See also the documentation of git-remote.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.