2

I am following the following process to duplicate a repository found here:

https://help.github.com/articles/duplicating-a-repository/

  1. Create a new private repository (new-repository.git) on github made sure not to create a readme - Done
  2. Create a bare clone of the public repository (old-repository.git) I want to duplicate by running

git clone --bare https://github.com/exampleuser/old-repository.git

Success.

  1. Then I do this:

cd old-repository.git

And this:

git push --mirror https://github.com/exampleuser/new-repository.git

I then get the error in my terminal that:

remote: Repository not found.
fatal: repository 'https://github.com/exampleuser/new-repository.git/' not found

I seems like I am missing a simple step. How can I find out what is going wrong and fix it.

akkdio
  • 573
  • 2
  • 5
  • 13
  • 1
    Try pushing to `https://yourusername@github.com/exampleuser/new-repository.git` to force git to ask for a password. – robertklep Oct 20 '18 at 20:50
  • 1
    Do you have 2FA activated? (https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/) – VonC Oct 20 '18 at 23:52
  • I tried both suggestions above - good suggestions. Thank you. I turn off 2FA and tried the @robertklep suggestion. When i add my password I get the following: "No refs in common and none specified; doing nothing. Perhaps you should specify a branch such as 'master'. Everything up-to-date" – akkdio Oct 21 '18 at 13:45
  • The error message "No refs in common..." suggest that there is step missing. Some suggestions on SO are to create a master found here; https://stackoverflow.com/questions/23528761/no-refs-in-common-and-none-specified-doing-nothing But that is not in the instructions. In fact you are told not to create a readme. Tried anyway and no joy – akkdio Oct 21 '18 at 14:12

2 Answers2

1

Add a new remote to your old repository and push your source to new remote repository.

$ cd old-repository
$ git remote add newremote https://github.com/exampleuser/new-repository.git

#pushes specific branch to remote
$ git push newremote some-branch-name

#pushes all branches to remote
$ git push newremote '*:*'

#pushes all tags to remote 
$ git push newremote --follow-tags 

Rajender Joshi
  • 4,155
  • 1
  • 23
  • 39
0

Had the same problem.

Create a new repo in the destination location before you try to push to it.

Don't initialize it with a readme, just create.

Then retry git push --mirror https://github.com/exampleuser/new-repository.git

Gwynnion
  • 33
  • 5