I am trying to move one of my SVN repositories to a new repository in GitHub.
Since I don't have much experience yet with Git, I'm trying to follow instructions I found on Stack Overflow and GitHub.
- I only need the trunk of the project, which is in a repository together with several other projects.
- I want to keep my history
- I am not planning to go back to SVN soon
I executed the following commands. What am I missing/doing wrong here?
git svn init https://svn.my-domain.org/svn/MyRepository/MyProject/trunk/
git svn fetch
git remote add origin git@github.com:MyUserName/myrepository.git
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git push
The last command gives me the following error:
To git@github.com:MyUserName/myrepository.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:MyUserName/myrepository.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I understand that I must merge my GitHub repository (witch has only the readme file) with the local Git repository with the files/history from SVN.
I tried in different ways the git push, but that didn't succeed. How should can I execute the push?
Thanks in advance