Sidney Sousa
Sidney Sousa

Reputation: 3614

How to push changes to repository after deleting and creating a new one

I was facing issues with my github repository and has decided to delete and create a new one with the same name.

I then typed this command in order to push the changes again to the repository:

$ git remote add origin [email protected]:Sidney-Dev/owlproperty.git

But it gave me a fatal error:

fatal: remote origin already exists.

I also tried

git push origin --force

but it takes forever to run and it does not work.

Is there a better fix for this?

Upvotes: 1

Views: 1469

Answers (1)

das-g
das-g

Reputation: 9994

You first have to update your local repository's (now invalid) knowledge about the (now replaced) remote repository:

git fetch origin --prune

Then you should be able to simply

git push origin

to push the current branch or

git push --all origin

to push all local branches.

Upvotes: 2

Related Questions