Search code examples
gitgithubgithub-for-windows

Git - fatal: remote origin already exists


I can not create origin remotely with remote command:

$ git remote add origin https://github.com/LongKnight/git-basics.git
fatal: remote origin already exists.

To solve the error, I have tried this:

$ git remote -v origin
$ git remote -v show origin

It is not uploading the files from my local repository to the remote:

$ git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Does each repository have its own origin?


Solution: I was using the Powershell that came with Github or Git Shell as it is also called to do my tutorial, once I switched to Git Bash it worked fine.


Solution

  • 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.