I'm having difficulties switching from an SVN repository hosted on code.google to a git repo on github. Specifically:
Variables:
This assumes that your $project name is the same on github as it is on code.google and you have already initialized your github repository.
Also, if your code.google repository is already GIT, you can skip to step 4.
Convert project from SVN to GIT. This is as easy as going into the Administration->Source tab and change it from SVN to GIT. By the way, the svn is still available after you do this; so don't worry about a complete code loss.
Convert source from code.google SVN to code.google GIT (keeping history)
git svn clone --stdlayout https://$project.googlecode.com/svn $project
cd $project
git remote add googlecode https://code.google.com/p/$project
git push --all googlecode
cd ..
Convert wiki from google SVN to google GIT (keeping history)
git svn clone https://$project.googlecode.com/svn/wiki $project.wiki
cd $project.wiki/
git remote add googlecode https://code.google.com/p/$project.wiki
git push --all googlecode
cd ..
Get new git repo from github
mkdir github
cd github/
git clone https://code.google.com/p/$project.git
cd $project/
Get source from code.google GIT to local github clone
git remote set-url origin https://github.com/$username/$project.git
git pull
Push source from local clone to github
git push origin master
Tell your local clone to push commits to github AND code.google
git remote set-url --add origin https://$project.googlecode.com/git
Test pushing commits to both github and code.google
touch test.txt
git add test.txt
git commit -m "Testing repo replication" test.txt
git push
Now, whenever you make changes to your local clone, it'll push those changes to both repositories.
Note: If you clone again in another location (like a different computer), you'll have to repeat step 6 again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With