Search code examples
gitsvnversion-controlgitlabgit-svn

SVN to GIT migration giving error as No refs in common


I am trying to migrate my projects from svn to git, based on steps given in this url: https://learn.microsoft.com/en-us/vsts/articles/perform-migration-from-svn-to-git?view=vsts#push-repository-to-a-bare-git-repository

But while pushing repository to bare git repository, I am getting below error:

C:\Git_Workspace\git_Repo>git push bare
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '../new_bare_repo.git'

I found one similar question here svn to git conversion no refs in common solution there is not helping but one comment suggested to add master like:

git push bare master

But it is not pushing my projects in bare repo just creating master file.

Any help to guide me what's happening in here is really appreciated..


Solution

  • It’s usually unnecessary to push local git repo to a local bare repo unless you want to treat the local bare repo as your remote git server.

    If you want to hosted the remote repo into 3rd-party (like github, bitbucket VSTS git repo etc), you can push to the remote repo directly:

    # After migrate svn repo to local git repo by git svn clone command
    cd reponame
    git remote add origin <remote repo URL>
    git push origin --all