Tag Archives: fatalremote origin already exists

Git submits the code to the remote warehouse with an error: fatal: remote origin already exists

problem

When adding a remote GitHub repository using git, you will be prompted with an error: fatal: remote origin already exists  , As shown in the figure below:

resolvent

1. Delete the remote git warehouse first:

$ git remote rm origin

2. Add the remote git warehouse again:

$ git remote add origin [email protected]:FBing/java-code-generator

However, if an error is reported when git remote RM origin is executed, we need to manually modify the contents of the gitconfig file:

$ vi .git/config

As shown in the figure below:

Just delete the line [remote “origin”].