I have a diffusion repository that I would like to import to github with complete history. I tried a few options that appeared on search. Maybe someone can help what would be the easiest option to do that. Many thanks in advance.
Asked
Active
Viewed 70 times
1 Answers
1
Normally, the easiest option is:
- create a (completely) empty repository on GitHub (no README, no nothing)
- go to your local repository
- add as origin the URL of your new GitHub empty repository
- push with mirror.
That is:
cd /path/to/local/repo
git remote add origin https://github.com/<me>/<myrepo>
# if origin already existed, change it with
git remote set-url origin https://github.com/<me>/<myrepo>
git push --mirror origin

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Thanks VonC. Remote origin already existed, so I run the second command. After pushing with mirror, I see both of my branches but only 24 commits in GitHub (out of 70 in diffusion). For the remaining 46 commits, it gives me an option to create a pull request. I would, however, like to have the repository in the exact same state as in Diffusion. Any other suggestions please? – Curious Jun 07 '20 at 13:17
-
@Curious Is this a public repository, that I can have a look? – VonC Jun 07 '20 at 13:49
-
Unfortunately, a private repo. Just a quick question, is it supposed to push *all* branches to GitHub? In another repo, it is missing even some branches. Any alternative solutions? – Curious Jun 07 '20 at 14:38
-
1@Curious Make sure your local repo has local branches for all upstream (original repo) first. Then the push --mirror will push everything. See https://stackoverflow.com/a/6300386/6309 – VonC Jun 07 '20 at 14:41
-
Thanks. And just to be sure, does it basically push from the local repo or from the remote one? As in do I need to make sure all local branches are up to date? – Curious Jun 07 '20 at 14:56
-
@Curious push from local to the new remote origin that you have set. If your local branches are up-to-date, they will appear in the new origin repo. – VonC Jun 07 '20 at 14:56
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/215472/discussion-between-curious-and-vonc). – Curious Jun 07 '20 at 15:27