14

I am trying to push my project files to my repository. But when I do that I get errors as in following screenshot.

Pushing files

I had a repository in that project file before and I deleted it. Now I have created another repository with a different name in that project file. But I get these errors now. Please tell me what I should do.

Den Isahac
  • 1,335
  • 11
  • 26
Buwaneka Sudheera
  • 1,277
  • 4
  • 17
  • 35
  • Remove your current remote and add a new one. Check `git remote` commands – Nico Van Belle Jul 10 '17 at 12:18
  • Possible duplicate of [Github "fatal: remote origin already exists"](https://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists) – mkrieger1 Jul 10 '17 at 12:19

2 Answers2

35

To update the origin to the new repository.

git remote set-url origin <new-url>

In your case, paste the command below if you updated your remote repo as per name suggested.

git remote set-url origin https://github.com/BSThisarasinghe/Sabra-Medical-Center.git
Den Isahac
  • 1,335
  • 11
  • 26
4

You need to update your remote settings.

First remove the old origin: git remote remove origin

Next, add the updated url: git remote add origin _new url_

After that, confirm everything looks good with git remote -v and you should be able to push again.

Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115