0

I need to migrate from a self-hosted GitLab instance, into GitHub. I have searched and would like to try the mirror method:

git remote add github https://yourLogin@github.com/yourLogin/yourRepoName.git
git push --mirror github

I did that and see the files and history on GitHub. Now, I am getting ready to decommission my GitLab server and I assume I need to remove the remote associated with it. This ought to work:

git remote rm origin
git remote rename github origin

When I do that, my config file get's messed up:

PS C:> git push origin

fatal: The current branch master has no upstream branch.

To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

I tried that, then made a change, staged, and pushed it, but it did not go to GitHub or GitLab (though git push origin says, "Everything up-to-date") and the status still shows I have a modified file.

For reference, my config file says:

[core]
    repositoryformatversion = 0     
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = git@github.com:myOrg/myRepo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

Not sure where I go from here.

StackExchangeGuy
  • 741
  • 16
  • 36
  • https://stackoverflow.com/questions/3333102/is-git-push-mirror-sufficient-for-backing-up-my-repository/3341392#3341392 – krisz Mar 31 '20 at 21:16
  • I do not understand how this helps. That OP had to push more than once to get "Everything up-to-date" while I have pending changes that are not pushed (after several tries). When I run ```git branch -a``` I have master, remotes/github/master, and remotes/origin/master. If there is a better way than "--mirror", to move from GitLab to GitHub, I would certainly like to hear it. – StackExchangeGuy Mar 31 '20 at 22:34
  • 1
    I just wanted to bring that peculiarity of `--mirror` to your attention. Anyway, it sounds like you didn't commit. – krisz Mar 31 '20 at 23:19

0 Answers0