Git - fatal: remote origin already exists

A bit easier:

git remote set-url origin https://github.com/LongKnight/git-basics.git

That will replace the current origin with a new one.


try this

git remote rm origin

then,

git remote add origin https://yourLink


I had a similar issue but I got it resolved using:

git remote set-url origin https://GitHub.com/Fasunle/my_portfolio.git

And then,

git push main master 

And it worked.

In order to use git push, you must specify final destination follorwed by local_branch ( in my own case, it is master for the local branch and main for the remote branch). They could however be the same. As in:

git push -u main local_branch_to_push

Or

git push -u master local_branch_to_push