-1

Suppose one has a git repository containing an empty project template. Now, one wants to use this template for a new git project with the same github account.

What I have tried:

git clone https://github.com/user12345/empty-project.git new_project

Then, I have created the new repository new_project on github, and:

cd new_project
git remote add origin https://github.com/user12345/new_project.git

But it raises the error:

error: remote origin already exists.
pietrodito
  • 1,783
  • 15
  • 24

1 Answers1

0

You'd have to remove the original origin and add the new one.

$ git remote remove origin
$ git remote add origin https://github.com/user12345/new_project.git

Or use

git remote set-url origin https://github.com/user12345/new_project.git
pietrodito
  • 1,783
  • 15
  • 24
prieber
  • 554
  • 3
  • 16