Kamalka Fernando
Kamalka Fernando

Reputation: 163

Github- Can't we create two repositories with same code

I recently working in a project and I want to make two repositories with same code. So I duplicate one and tried to insert into git as a new repository. But it directed to the old repositories and committed there. Any help from someone please.

Upvotes: 2

Views: 1746

Answers (1)

Justin Beckwith
Justin Beckwith

Reputation: 7866

If you are working in a single directory on your machine, and want to push code to multiple GitHub repositories, that's totally possible. What you're looking for is multiple remotes.

When you did a git clone, it probably created a origin remote that looks like [email protected]:JustinBeckwith/linkinator.git.

To see the remotes you already have, try:

$ git remote -v

To add a second remote, first find the URI on the second GitHub repository you want to use: Using the clone button on GitHub

Copy that URI, and add it to your existing repository with:

$ git remote add second [email protected]:JustinBeckwith/linkinator-2.git

You could then push code by saying:

$ git push second master

Hope this helps!

Upvotes: 4

Related Questions